-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
std.mem.eql changes values memory #19564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The issue here is that you're creating a stack variable |
Oh okay me being dumb thanks for the speedy response ! :) |
not knowing something doesnt make you dumb :) |
Is it very hard to implement to print an error in compiler when it seeing code like this? Or zig deliberately doesn't do this? |
its planned, just hasn't been implemented yet #5725 |
That proposal isn't accepted, so saying "it's planned" is a bit misleading |
Zig Version
0.12.0-dev.3029+723d13f83
Steps to Reproduce and Observed Behavior
I was trying to write a basic print for a date. When I ran this the first print will be:
BEFORE a: { 50, 48, 50, 52, 45, 48, 52, 45, 48, 54 } b: { 50, 48, 50, 52, 45, 48, 52, 45, 48, 54 }
and the second
AFTER a: { 8, 192, 52, 0, 0, 0, 0, 0, 8, 192 } b: { 50, 48, 50, 52, 45, 48, 52, 45, 48, 54 } equal: false
Im pretty new to zig so there is a high chance I am doing something wrong. Tried to hunt for where it could possibly be changing the value and it seems to happen before
eqlBytes(sliceAsBytes(a), sliceAsBytes(b)
. I couldn't quite work out where though.Expected Behavior
I would expect the memory from the first value I passed in not to change.
The text was updated successfully, but these errors were encountered: