Hi all,
I’m having trouble understanding why boolean is taking 4 bytes instead of 1 byte in structs.
Here is an example:
struct F8
p::Float32
t::Float32
end
get_F8() = F8(0.0f0, 0.0f0)
println(sizeof(get_F8())) # 8 bytes, correct
struct F12
p::Float32
t::Float32
b::Bool # why 4 bytes?
end
get_F12() = F12(0.0f0, 0.0f0, true)
println(sizeof(get_F12())) # 12 bytes, incorrect was expecting 9 bytes
struct F1
b::Bool # 1 byte
end
get_F1() = F1(true)
println(sizeof(get_F1())) # 1 byte, correct
Thanks!