Zig NEWS

Discussion on: What's a String Literal in Zig?

Collapse
 
mrkishi profile image
mrkishi

Cheers!

In case anyone is following along, I updated the example to better demonstrate where consts end up in memory: godbolt.org/z/jM75hf5b9.

I don't know whether Zig provides a way to check what kind of memory a pointer points to, or if it exposes sections' addresses (eg. gcc's end, edata and etext), but note how get_ptr_static basically returns the address of an unnamed label, which is before the heap (and way before the stack, which grows downwards).