zig icon indicating copy to clipboard operation
zig copied to clipboard

Handle sentinel slices in `std.mem.zeroes`. Fixes #13256

Open IntegratedQuantum opened this issue 4 years ago • 0 comments

Adding an error message seems to be the only reasonable way to handle this. Otherwise we'd need to have a memory region that contains the sentinel value.

However I took the freedom of adding a special case for null-terminated string literals [:0] const u8. These are the most common use-case for sentinel slices, so I think it makes sense to handle these seperately. This also makes the use case #13256 work.

IntegratedQuantum avatar Nov 05 '22 10:11 IntegratedQuantum