this post was submitted on 22 Jul 2025
407 points (98.1% liked)
Programmer Humor
25282 readers
652 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
#pragma push
Context?
You use it to "pack" bitfields, bytes etc together in structs/classes (wo functions), otherwise the computer usually align every variable on a 32bit boundary for speed.
You don't need that pragma to pack bitfields.
With say a 3bit int, then a 2bit int and various char, int etc and so on you did have to use the pragma with gcc & visual around 2012 at least
OK, I use the Keil ARM compiler, and never needed to push anything.
Then I'd make a unit test, there is no requirement to do so by the compiler (not even the order).