Comment by pjmlp

3 hours ago

If the compiler optimizer doesn't reorder the struct fields depending on which flags or pragmas are used, and you could teach that as well in other compiled languages, ignoring the market size of each language.

The C optimizer is not allowed to re-order, so, unless you've specifically used some implementation override you know exactly how C will lay out basic types.

Likewise packing isn't allowed by the standard, so you'd again only need to talk about packing if you want to.

This seems like a reasonable place to start. Like the way driving school teaches you a U-turn but not a J-turn. Is a J turn actually a thing you might need? Maybe, but it's definitely not where we should start.

  • Well, we cannot talk about ISO C for some things, and Compiler Specific C for others, depending on the convinience of what is being discussed.