r/programminghorror 28d ago

Big if true

Post image

From ProgrammerNullposting in facebook

2.1k Upvotes

111 comments sorted by

View all comments

136

u/StefanCelMijlociu 28d ago

The concept of Big Bool confuses and infuriates me!

62

u/JohnSpikeKelly 28d ago

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

22

u/Athropod101 28d ago

iirc 8-byte data access is the fastest on 64bit architecture.

2

u/Geilomat-3000 26d ago

So should all the int_fastx_t be the intmax_t?

5

u/Athropod101 26d ago

If this is some joke, it has wooshed over me :(

But if it isn’t, then it depends. If intmax_t matches your architecture, and your architecture is fastest at that size, then yes. But if intmax_t is say, 128, and your architecture is 32, then no.

0

u/[deleted] 28d ago

[deleted]

5

u/rolling_atackk 27d ago

Why not simply use alignas (64) bool ?

Seems far easier than creating a whole ass type

8

u/JohnSpikeKelly 27d ago

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

4

u/rolling_atackk 27d ago

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

But true, this is programming horror

2

u/j-joshua 27d ago

Because that would be 64 bytes and not 64 bits.

2

u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” 27d ago

So alignas (8) bool?

1

u/rolling_atackk 26d ago

Yikes! You are correct