-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Aligned slices are unusable #22858
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
no whining on the issue tracker |
why have you opted out of array alignment? |
If you mean, 'why did i not use default alignment', that is because i'm reading file from disk which is guaranteed (in my use case) to Not be aligned. |
in this case the solution is not to bloat the executable with a bunch of alternate std.mem functions for operating on unaligned arrays, it's to load your data into aligned arrays, or better yet actually parse the file for validity. looks like another case of the restriction helping you write better code. |
Problem
slices with non-default alignment (like
[]align(1) u32
) can't be used inmem.eql
,sort.binarySearch
,sort.partitionPoint
,sort...
and in many othersProposed solution
add 'Context' variants to these function much like
sort.pdqContext
or
make array argument
anytype
.or
This could have been solved by #9260
Zig version:
0.14.0-dev.3187+d4c85079c
The text was updated successfully, but these errors were encountered: