≈ the.bay.news

Unbounded slice of many pointer vs pointer arithmetic

Ziggit
Unbounded slice of many pointer vs pointer arithmetic
Why does Zig allow an unbounded slice of a many pointer, when it appears to be the same as many pointer arithmetic? var many_ptr: [*]const u8 = &[2]u8{1, 2}; @compileLog(@TypeOf(many_ptr + 1)); // [*]const u8 @compileLog(@TypeOf(many_ptr[1..])); // [*]const u8 I think bounded slicing producing e.g. *[n]u8 is justified, because the result has a length, and it implicitly converts to a []u8 slice. But why allow unbounded slice syntax for a many pointer when it doesn’t actually do any ...

Why does Zig allow an unbounded slice of a many pointer, when it appears to be the same as many pointer arithmetic? var many_ptr: [*]const u8 = &[2]u8{1, 2};…

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.