News for hackers. Stuff that matters.
Re:Is Zig's New Writer Unsafe? by metaltyphoon on Saturday September 20, 2025 @01:02PM (#45315104)
> Like a modern C with lessons learned.

Yet no string types. So lessons not so well learned. Zig does remove many warts in C.

Re:Is Zig's New Writer Unsafe? by ManBeardPc on Saturday September 20, 2025 @01:18PM (#45315235)
It has proper arrays and slices, even being able to define a sentinel value in the type system, so you know when it is a C string or a slice with a specific size with arbitrary values. Strings can become a problem if you need another encoding than the chosen one. Then you start to use byte slices anyway. You need to allocate a new one if you want to change just a part of it. Safer yes, but can produce unwanted overhead and you have to duplicate many APIs for strings and byte arrays as it is the case in Go.
Re:Is Zig's New Writer Unsafe? by pjmlp on Sunday September 21, 2025 @01:56AM (#45320397)
Many of those warts were already not present in other systems languages predating C, and others of similar age.
Re:Is Zig's New Writer Unsafe? by user____name on Monday September 22, 2025 @08:05AM (#45332245)
It feels like C but raised with Java as its strict stepfather.