cm0002@lemmy.world to Programmer Humor@programming.dev · 6 days agoTell me the truth ...piefed.jeena.netimagemessage-square152fedilinkarrow-up11.17Karrow-down117
arrow-up11.16Karrow-down1imageTell me the truth ...piefed.jeena.netcm0002@lemmy.world to Programmer Humor@programming.dev · 6 days agomessage-square152fedilink
minus-squarebrian@programming.devlinkfedilinkarrow-up1·5 days agothings that store it as word size for alignment purposes (most common afaik), things that pack multiple books into one byte (normally only things like bool sequences/structs), etc
minus-squaretimhh@programming.devlinkfedilinkarrow-up1·1 day ago things that store it as word size for alignment purposes Nope. bools only need to be naturally aligned, so 1 byte. If you do struct SomeBools { bool a; bool b; bool c; bool d; }; its 4 bytes.
minus-squarebrian@programming.devlinkfedilinkarrow-up1·1 day agosure, but if you have a single bool in a stack frame it’s probably going to be more than a byte. on the heap definitely more than a byte
things that store it as word size for alignment purposes (most common afaik), things that pack multiple books into one byte (normally only things like bool sequences/structs), etc
Nope. bools only need to be naturally aligned, so 1 byte.
If you do
struct SomeBools { bool a; bool b; bool c; bool d; };
its 4 bytes.
sure, but if you have a single bool in a stack frame it’s probably going to be more than a byte. on the heap definitely more than a byte