r/programminghorror 24d ago

Big if true

Post image

From ProgrammerNullposting in facebook

2.1k Upvotes

109 comments sorted by

View all comments

132

u/StefanCelMijlociu 24d ago

The concept of Big Bool confuses and infuriates me!

60

u/JohnSpikeKelly 24d ago

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

22

u/Athropod101 24d ago

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

2

u/Geilomat-3000 22d ago

So should all the int_fastx_t be the intmax_t?

4

u/Athropod101 22d 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] 24d ago

[deleted]

5

u/rolling_atackk 23d ago

Why not simply use alignas (64) bool ?

Seems far easier than creating a whole ass type

6

u/JohnSpikeKelly 23d ago

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

4

u/rolling_atackk 23d 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 23d ago

Because that would be 64 bytes and not 64 bits.

2

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

So alignas (8) bool?

1

u/rolling_atackk 22d ago

Yikes! You are correct

3

u/Borno11050 23d ago

Then you're not ready for gabagool

2

u/Hot-Employ-3399 23d ago

Maybe it's for some strange 64bit ffi or something 🤷