zig/lib
Isaac Freund 23b7d28896 std: restrict mem.span() and mem.len() to sentinel terminated pointers
These functions are currently footgunny when working with pointers to
arrays and slices. They just return the stated length of the array/slice
without iterating and looking for the first sentinel, even if the
array/slice is a sentinel terminated type.

From looking at the quite small list of places in the standard
library/compiler that this change breaks existing code, the new code
looks to be more readable in all cases.

The usage of std.mem.span/len was totally unneeded in most of the cases
affected by this breaking change.

We could remove these functions entirely in favor of other existing
functions in std.mem such as std.mem.sliceTo(), but that would be a
somewhat nasty breaking change as std.mem.span() is very widely used for
converting sentinel terminated pointers to slices. It is however not at
all widely used for anything else.

Therefore I think it is better to break these few non-standard and
potentially incorrect usages of these functions now and at some later
time, if deemed worthwhile, finally remove these functions.

If we wait for at least a full release cycle so that everyone adapts to
this change first, updating for the removal could be a simple find and
replace without needing to worry about the semantics.
2023-01-29 15:07:06 -05:00
..
compiler_rt cbe: fixes for tls, support for not linking libc, and enabling tests 2023-01-29 15:04:13 -05:00
docs autodoc: added support for tuple structs 2023-01-25 15:34:04 +01:00
include
init-exe
init-lib
libc wasi-libc: use __heap_end if available (#14273) 2023-01-12 13:48:14 +00:00
libcxx dragonfly: port libc++ 2023-01-02 19:18:33 -05:00
libcxxabi
libunwind
std std: restrict mem.span() and mem.len() to sentinel terminated pointers 2023-01-29 15:07:06 -05:00
tsan
build_runner.zig zig build system: add LibExeObjStep.installLibraryHeaders 2023-01-25 02:45:57 -05:00
c.zig
compiler_rt.zig compiler-rt: implement __udivei4 and __umodei4 (#14023) 2022-12-22 16:29:19 -05:00
ssp.zig
test_runner.zig wasm: uses main instead of main2 for test runner 2023-01-26 17:49:43 +01:00
zig.h cbe: fixes for tls, support for not linking libc, and enabling tests 2023-01-29 15:04:13 -05:00