Hacker News new | ask | show | jobs
by boundchecked 1351 days ago
Zig's comptime variables had this fairly bonkers behavior that basically evaluate by themselves regardless of the underlying runtime controlflow[1], I thought it was cool, but seems to be disabled on trunk build.

[1]https://godbolt.org/z/dbnG9eev7

1 comments

From testing it seems like it is executing both branches, i.e. if (b) { v+= x; } else { v += y; } is effectively v += x + y. That doesn't make much sense so I can see why it was fixed.