4 ms·
Very cool article. If you are going to have a bunch of packed structs, though, it's often easier to wrap all the structs in #pragma pack(0)/pack() rather than
by daeken 15y ago
Very cool article. If you are going to have a bunch of packed structs, though, it's often easier to wrap all the structs in #pragma pack(0)/pack() rather than putting the attribute on each member. This is an MSism, but it works in gcc.
- zx2c4 15y agoThanks a lot for this tip! Saves a lot of writing. I knew there had to be a better way... Ideally, I guess I wouldn't read directly into a struct, though, and instead use the right functions from endian.h to make the code portable, but ah! such is life when you're scrambling to save a zip and the post-graduation nostalgia is high and the post-coffee-crash caffeination is low.