Zig NEWS

Discussion on: Type/pointer cheatsheet

 
toxi profile image
Karsten Schmidt

I'd think it's because there's no concept of optional values in C, yet optional pointers can be represented in the same amount of space (using 0 as indicator for a null pointer), whereas optional non-pointer values take up extra bytes, e.g. a ?u8 is actually 2 bytes, a ?u16 is 4 bytes, a ?u32 is 8 bytes...

An argument could be made that by that logic slices shouldn't be supported either (but they are), so I really don't know the reasons... :)