Zig Version
0.14.0-dev.1951+857383689
Steps to Reproduce and Observed Behavior
comptime {
const a: u32 = 0;
@compileLog(&a);
@compileLog(@as([*]const u8, @ptrFromInt(1)));
}
Compile Log Output:
@as(*const u32, @as(u32, 0))
@as([*]const u8, @as([*]const u8, @ptrFromInt(1)).*)
@compileLog seems to try to represent the value being pointed to rather than the pointer but in both cases it ends up being wrong. the second one also dereferences a many-item pointer
Expected Behavior
i think the second one should just be @as([*]const u8, @ptrFromInt(1)), not particularly useful but correct, not any worse than current. the first one maybe should show @as(*const u32, &a)? im not sure if that would really be useful, @as(*const u32, &@as(u32, 0)) could work if we wanted it to be a little more descriptive so it'd show the underlying value for vars
Zig Version
0.14.0-dev.1951+857383689
Steps to Reproduce and Observed Behavior
@compileLogseems to try to represent the value being pointed to rather than the pointer but in both cases it ends up being wrong. the second one also dereferences a many-item pointerExpected Behavior
i think the second one should just be
@as([*]const u8, @ptrFromInt(1)), not particularly useful but correct, not any worse than current. the first one maybe should show@as(*const u32, &a)? im not sure if that would really be useful,@as(*const u32, &@as(u32, 0))could work if we wanted it to be a little more descriptive so it'd show the underlying value forvars