Hacker News new | ask | show | jobs
by renox 707 days ago
I'm surprised that the list of Zig quirks doesn't include aliasing and functions parameters: the compiler can pass your parameter by value or by reference as it wants so your function behaviour can change in case of aliasing..

An implementation defined behaviour worse than C, that's surprising..

Ada has the same issue, I wonder if Ada users can tell us if this pitfall is an issue or not in practice.

1 comments

Since function parameters are immutable in Zig, is this a difference that you need to care about?
The parameter is immutable so if you pass a pointer, the pointer is immutable, but the pointed value isn't.. If the pointer alias another 'immutable' parameter, this parameter may not be immutable anymore..