r/ProgrammerHumor • • Oct 07 '26

Meme wasteOfPreciousSpace

Post image
7.3k Upvotes

244 comments sorted by

View all comments

13

u/PixelBrush6584 Oct 07 '26

C++ stays winning because of bitfields

bool var0 : 1;
bool var1 : 1;
bool var2 : 1;
bool var3 : 1;

And all four of them together share a byte!

7

u/Amadex Oct 08 '26

bitfields aren't a c++ gimmick, it's well known in programming and can be done in many other languages

3

u/PixelBrush6584 Oct 08 '26

Well yeah, but I only became aware of them through C++ lul

3

u/Ok_Tea_7319 Oct 08 '26

We also have the abomination that is std::vector<bool>.

2

u/Zetice Oct 08 '26

This is terrible but fielding.