Im new to zig an I ran into this issue:
With this C code the size of the packed struct is 9 bytes
typedef struct {
u8 foo;
u64 baa;
} __attribute__((packed)) MyPackedStruct;
_Static_assert(sizeof(MyPackedStruct) == 9, "");
But when I tried to replicate this behaviour with zig the struct
size is 16 bytes
const MyPackedStruct = packed struct {
foo: u8,
baa: u64,
};
comptime {
@compileLog(@sizeOf(MyPackedStruct));
@import("std").debug.assert(@sizeOf(MyPackedStruct) == 9);
}
I tested this on master an on 0.13.0, what am I doing wrong?