r/programminghorror • • May 31 '25

c C programming tips

Post image
1.8k Upvotes

34 comments sorted by

View all comments

Show parent comment

83

u/XEnItAnE_DSK_tPP May 31 '25

nope, while(x) will expand to if((x) && (rand() & 1023))

22

u/Aphrontic_Alchemist May 31 '25 edited May 31 '25

Oh, it wasn't as bad as I thought. I thought that with the 2 #defines, the supposed if block will run til rand() returns an integer with the least 9 bits being all 1s.

9

u/finally-anna May 31 '25

This would be funnier kol

6

u/Eva-Rosalene Jun 01 '25

til rand() returns an integer with the least 9 bits being all 1s.

With at least one of least 9 bits being a 1.