4 ms·
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
by renox 2y 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.
- danvk 2y agoSince function parameters are immutable in Zig, is this a difference that you need to care about?
- renox 2y agoThe 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..