2 ms·
Zig's type system tries to be aware of what its pointing to. Is it an array of comptime known length? An array of unknown length? An array of runtime known leng
by AnIdiotOnTheNet 8y ago
Zig's type system tries to be aware of what its pointing to. Is it an array of comptime known length? An array of unknown length? An array of runtime known length? or a single item? Is it mutable? What's its alignment requirement? etc. It even has a pointer type for "something that came from C, who the hell knows". There is an accepted proposal to have pointer types for null-terminated blocks of memory too.
So when you create a pointer out of thin air, you have to inform the type system precisely what kind of pointer it is. That's why it is so much more gnarly than C, it wants you to be explicit.