Zig NEWS

Discussion on: Cool Zig Patterns - Paths in Build Scripts

Collapse
 
nairou profile image
Nairou

Very useful! Since you're using ++ in both examples, can you explain how they differ? Does the stage2 compiler require ++ use within an explicit comptime block for the result to be comptime?

Collapse
 
xq profile image
Felix "xq" Queißner

++ in the first example returns a pointer-to-temporary, whereas the second example returns a comptime known value that is guaranteed to put into the .rodata section and has a lifetime of the whole program life time