r/C_Programming • u/anduygulama • Jun 09 '26
packed attribute for structs
Why don't C compilers automatically optimize/pack structures instead of requiring explicit attributes?
2
Upvotes
r/C_Programming • u/anduygulama • Jun 09 '26
Why don't C compilers automatically optimize/pack structures instead of requiring explicit attributes?
View all comments
Show parent comment
1
u/Silly_Guidance_8871 Jun 09 '26
To add: And given that optimal can mean different things in different contexts, you need some way to inform the compiler which is which — attributes give you (some of) that ability.