-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
empty slice should still assign ptr properly #4771
Comments
My current workaround is to assign to |
This was a language decision that consciously changed in that commit. But let's make it a bit more formal, by at least having this be a proposal to revert the language semantics. |
What's the behaviour supposed to be then? In my use case I have multiple slices. One with the full memory block and another with the part that's actually in use. Sometimes it has to be reset to be empty which is done with |
This bit me when I had an ArrayList with 0 items (but large capacity): the |
libgit2 allows the `parents` pointer to be null if there are 0 parents, and Zig appears to set `ptr` to null for zero-length slices: ziglang/zig#4771
libgit2 allows the `parents` pointer to be null if there are 0 parents, and Zig may set `ptr` to null for zero-length slices: ziglang/zig#4771
Zig version: 0.5.0+153c6cf92
It's also works fine using an array to initialize the first slice somehow:
My git bisect said:
2182d28cb0917b8d869d13802a5955ee35b4537a is the first bad commit
The text was updated successfully, but these errors were encountered: