Regex alignment changed warning with VC2005 amd64 platform

I am getting the following warning when I compile Regex 1-33-1 with VC2005 for amd64 platform: --> # include BOOST_ABI_SUFFIX alignment changed after including header, may be due to missing #pragma pack(pop) Does anyone know what this is all about? Regards, George.

George M. Garner Jr. wrote:
I am getting the following warning when I compile Regex 1-33-1 with VC2005 for amd64 platform:
--> # include BOOST_ABI_SUFFIX
alignment changed after including header, may be due to missing #pragma
pack(pop)
Does anyone know what this is all about?
Sometimes, you'll need structures to be packed to a specific byte count, for example when you're reading directly from a file, or simply to ensure binary compatibility with something that's already defined. The way to achieve this in VC++ is the #pragma pack instruction, used like this: #pragma pack (push, 1) // Align members at 1-byte boundaries (pack tightly) and remember the old state. struct packed { char c; float f; }; // sizeof(packed) == sizeof(char) + sizeof(float) #pragma pack (pop) // restore old state A very common way of placing these pragmas has been to include one header file that contains the push pragma before doing your stuff, and another containing the pop pragma after doing your stuff. This has two advantages: 1) Only one place to change if you have several files with the same alignment requirement. Since they all included the same header, you just need to change the header. 2) Easy porting to a different compiler that uses a similar mechanism. (gcc doesn't). Apparently, though, MS decided that the compiler being in a different state before and after a header is a bad thing (probably a good idea in general) and thus made VC++8 emit a warning if a header changes the packing without changing it back. The solution here would be to look at the Platform SDK. Since it contains the same technique, it should also show a way to avoid the warning. (Probably by disabling it.) Then apply that technique to the Boost ABI headers. Sebastian Redl

Sebastian,
...and thus made VC++8 emit a warning...<
Sounds logical. However, I would note that I don't get this warning on x86 builds. It's only the amd64 cross-compiler, as I stated in my original post.
Probably by disabling it <
It may be better just to document and live with it. As you say, it's probably a good thing elsewhere. Regards, George.
participants (2)
-
George M. Garner Jr.
-
Sebastian Redl