4 ms·
Structs get written directly to disk and network. Copies of the same program would produce different output depending on the optimization strategy they were com
by superuser2 10y ago
Structs get written directly to disk and network. Copies of the same program would produce different output depending on the optimization strategy they were compiled with. That's vigorously not allowed.
- kazinator 10y agoAlso, the translation unit compilation model of C would be troublesome here, if optimization settings could influence struct layout. You can't have different translation units interpreting the same struct type declaration differently.
- maccard 10y ago> You can't have different translation units interpreting the same struct type declaration differently. Sure you can! // MyHeader.h struct MyStruct { int A; char b; int* c; }; // A.cpp #include "MyHeader.h" <...> // B.cpp #pragma pack(push, 16) #include "MyHeader.h" #pragma pack(pop) <...>