I understand the idea that each scanline should have a number of bytes that is a multiple of 4. Otherwise, the BMP is stored in a such a way that each scanline is padded with as many zeros as it takes to extend that scanline's length to be a multiple of 4.
Later on pset 5 specifications page are these lines
Our use, incidentally, of the
__packed__ensures that clang does not try to "word-align" members (whereby the address of each member’s first byte is a multiple of 4), lest we end up with "gaps" in our
structs that don’t actually exist on disk.
I don't really understand what that means. Now,
- What does it mean that clang may "word-align" members of
- How would it do that?
- And why?