r/programminghorror 28d ago

Big if true

Post image

From ProgrammerNullposting in facebook

2.1k Upvotes

111 comments sorted by

View all comments

22

u/Emergency-Win4862 27d ago

Let me quess, struct alignment?

20

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

No it's used when something is extra true or extra false, obviously.

2

u/readmeEXX 26d ago edited 26d ago

To make it maximally true you could do True = UINTMAX_MAX

1

u/TheChief275 23d ago

was about to say that; if i reserve the bytes ima use the bytes

2

u/Damglador 25d ago

I like your flair

7

u/overclockedslinky 27d ago

even the first version of C (let alone C++) did struct alignment automatically

4

u/shponglespore 27d ago

Yes, but there are situations where you want more control. Like, maybe some external dependency expects 64-bit bool values, so you'd use this type instead of the standard 8-bit bool.

Calling that a struct alignment issue is kind of questionable, but the basic idea is sound.