Russell Hind wrote:
As mentioned in the rest of the thread by Edward Diener, bcc32 supports #pragma option push and #pragma option pop to temporarily force compiler options, which as also mentioned, is how the headers that come with the compiler are configured so that the alignment for anything declared in there headers matches what was built into the .lib and therefore we can use our own compiler options for our code but not run into any problems with the pre-compiled libraries.
Do you not think the same approach would work in boost? (I don't know how much support there is for push and pop of options in other compilers, though)
Microsoft has #pragma pack(push,n) #pragma pack(pop) for packing and since all enum sizes are the same in VC++, that more or less takes care of their data layout problems. I wouldn't be surprised if other compilers also have appropriate #pragmas also, but VC++ and BCB are the only ones in C++ I am currently using. Maybe a gcc expert knows something about its technique, if any, to ensure data layout compatibility within the header file itself.