In C/C++ a bool is stored in a byte (8 bits) and a BOOL is stored in 4 bytes (32 bits). What is the memory layout for a bool in Zig, and why does attempting to write it out using std.fs.File.writer().writeStruct() result in the following error?
lib/std/mem.zig:2023:57: error: expected integer or vector, found 'bool'
@field(ptr, f.name) = @byteSwap(@field(ptr, f.name));
^~~~~~~~~~~~~~~~~~~
referenced by:
writeStructEndian__anon_3446: /home/aero/Utility/zig-linux-x86_64-0.13.0/lib/std/io/Writer.zig:69:30
writeStructEndian: /home/aero/Utility/zig-linux-x86_64-0.13.0/lib/std/io.zig:348:59
remaining reference traces hidden; use '-freference-trace' to see all reference traces
Here is the struct I was attempting to test writing with:
const BoxedTypeOne = packed struct {
flag: bool,
letter: u8,
u32_value: u32,
};