| ▲ | bjackman 18 hours ago | ||||||||||||||||||||||||||||||||||
'bool' is still at least 1 byte in C. If you want to store one Boolean per bit you have to manually implement a bitmap. | |||||||||||||||||||||||||||||||||||
| ▲ | tyromaniac 18 hours ago | parent | next [-] | ||||||||||||||||||||||||||||||||||
Or pull out the C++ and use std::vector<bool>,... But you should probably never do that | |||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||
| ▲ | viega 17 hours ago | parent | prev | next [-] | ||||||||||||||||||||||||||||||||||
A bool does automatically cast to an unsized bit slice. Meaning, if you have a struct and you want to bit-pack your booleans, you can declare each one as, say, uint8_t some_bool : 1; You may then do `x.some_bool = true;` etc. It's a small nicety to avoid bitwise operators, anyway. | |||||||||||||||||||||||||||||||||||
| ▲ | ReDress 18 hours ago | parent | prev [-] | ||||||||||||||||||||||||||||||||||
[dead] | |||||||||||||||||||||||||||||||||||