Zig NEWS

Discussion on: Type/pointer cheatsheet

Collapse
 
kristoff profile image
Loris Cro

Pointers, slices and arrays definitely have a very compact set of symbols that can be hard to remember. In my mind this makes sense because that's one of the abstract entities that lower-level programming requires you to manipulate with agility, not too differently from how physicists use "compact" symbols for the abstract concepts they need to manipulate efficiently.

One thing that I haven't done yet, but that I plan to do in sooner or later, is a post about when and how Zig ensures the presence of a sentinel, and when you have to do it yourself.

Collapse
 
toxi profile image
Karsten Schmidt • Edited

Thanks, Loris! I generally have zero issues with the syntax elements on their own, just often still not sure about the correct order (and the resulting semantics). Seeing the variations side by side really clarified things for me and maybe for others too...

Btw. Keeping an eye out for that sentinel post, sounds intriguing! So far I'm fine knowing strings are zero-terminated (in addition to being slices by default) and I'm also supporting both facts in my WASM/JS interop/codegen project (thi.ng/wasm-api)