cm0002@lemmy.world to Programmer Humor@programming.dev · 2 months agoTell me the truth ...piefed.jeena.netimagemessage-square97linkfedilinkarrow-up122arrow-down11
arrow-up121arrow-down1imageTell me the truth ...piefed.jeena.netcm0002@lemmy.world to Programmer Humor@programming.dev · 2 months agomessage-square97linkfedilink
minus-squareKindaABigDyl@programming.devlinkfedilinkarrow-up4·2 months agotypedef struct { bool a: 1; bool b: 1; bool c: 1; bool d: 1; bool e: 1; bool f: 1; bool g: 1; bool h: 1; } __attribute__((__packed__)) not_if_you_have_enough_booleans_t;
minus-squarexthexder@l.sw0.comlinkfedilinkarrow-up2·edit-22 months agoOr just std::bitset<8> for C++. Bit fields are neat though, it can store weird stuff like a 3 bit integer, packed next to booleans
Or just
std::bitset<8>
for C++. Bit fields are neat though, it can store weird stuff like a 3 bit integer, packed next to booleansYou beat me to it!