BitmapHeader struct size riddle

extern defines the memory layout according to the C ABI: Documentation - The Zig Programming Language. The C implementation may introduce padding after/between fields for alignment reasons.

If you use packed struct, you’ll get 0 padding between fields, but that doesn’t mean an exact sizeOf: Inconsistent sizeOf vs bitSizeOf

3 Likes