zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit d7c6cfa7fdf51f0b52aa3666aaa3022bd8e4876f (tree)
parent 0b1e8690dadb5d81b4d63832e27a117f57b4be81
Author: xdBronch <51252236+xdBronch@users.noreply.github.com>
Date:   Thu,  6 Jul 2023 13:43:50 -0400

std.mem.zeroes work with allowzero pointers
Diffstat:
Mlib/std/mem.zig | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/std/mem.zig b/lib/std/mem.zig @@ -276,7 +276,8 @@ pub fn zeroes(comptime T: type) T { return null; }, .One, .Many => { - @compileError("Can't set a non nullable pointer to zero."); + if (ptr_info.is_allowzero) return @ptrFromInt(0); + @compileError("Only nullable and allowzero pointers can be set to zero."); }, } },