Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That is a very good point. Every C/C++ developer should be familiar with #pragma pack (Visual Studio... not sure what the GCC equivalent is).


gcc has __attribute__((packed)), but we may be talking about different things - that's mostly used for on-the-wire protocols. For most structs, laying out the members from large to small works fine, and avoids superfluous shifting on every read and write.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: