mirror of
https://github.com/ziglang/zig.git
synced 2026-01-21 06:45:24 +00:00
std.mem.zeroInit: zero hidden padding for extern struct
Signed-off-by: Tw <tw19881113@gmail.com>
This commit is contained in:
parent
8bbc906b59
commit
e584dd8062
@ -437,7 +437,7 @@ pub fn zeroInit(comptime T: type, init: anytype) T {
|
||||
}
|
||||
}
|
||||
|
||||
var value: T = undefined;
|
||||
var value: T = if (struct_info.layout == .Extern) zeroes(T) else undefined;
|
||||
|
||||
inline for (struct_info.fields, 0..) |field, i| {
|
||||
if (field.is_comptime) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user