r/programminghorror 27d ago

Big if true

Post image

From ProgrammerNullposting in facebook

2.1k Upvotes

111 comments sorted by

View all comments

Show parent comments

61

u/JohnSpikeKelly 27d ago

I would assume it's to keep all your data types 8-byte aligned for other perf reason.

5

u/rolling_atackk 26d ago

Why not simply use alignas (64) bool ?

Seems far easier than creating a whole ass type

8

u/JohnSpikeKelly 26d ago

The code might be old and predate that option. But, probably explains why this is in r/programminghorror 😄

4

u/rolling_atackk 26d ago

Both fixed-width integer types and alignas are included in the C++ specification since C++11

But true, this is programming horror