We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
0.13.0-dev.46+3648d7df1
Compile and run example program with zig run omit_sentinel_safety_check.zig omit_sentinel_safety_check.zig:
zig run omit_sentinel_safety_check.zig
omit_sentinel_safety_check.zig
var src_mem: [3:0]u8 = .{ 'a', 'b', 'c' }; pub fn main() void { const src_ptr: [:0]const u8 = &src_mem; const slice: [:0]const u8 = src_ptr[0..1 :0]; if (slice[slice.len] != 0) { unreachable; } }
Output:
zig run omit_sentinel_safety_check.zig thread 78585 panic: reached unreachable code ./omit_sentinel_safety_check.zig:6:9: 0x1033c18 in main (omit_sentinel_safety_check) unreachable; ^ ~/.local/src/zig-linux-x86_64-0.13.0-dev.46+3648d7df1/lib/std/start.zig:501:22: 0x1033469 in posixCallMainAndExit (omit_sentinel_safety_check) root.main(); ^ ~/.local/src/zig-linux-x86_64-0.13.0-dev.46+3648d7df1/lib/std/start.zig:253:5: 0x1032fd1 in _start (omit_sentinel_safety_check) asm volatile (switch (native_arch) { ^ ???:?:?: 0x0 in ??? (???)
The program should panic with sentinel_mismatch.
sentinel_mismatch
The text was updated successfully, but these errors were encountered:
slice_sentinel
slice_length
Successfully merging a pull request may close this issue.
Zig Version
0.13.0-dev.46+3648d7df1
Steps to Reproduce and Observed Behaviour
Compile and run example program with
zig run omit_sentinel_safety_check.zig
omit_sentinel_safety_check.zig
:Output:
Expected Behaviour
The program should panic with
sentinel_mismatch
.The text was updated successfully, but these errors were encountered: