Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying to get rid of a c++ boost warning

Tags:

c++

boost

Whenever I include boost in my project I get a million of these warnings. Does anyone know how I can get rid of the warnings?

../depends\boost/config/abi_prefix.hpp(19) : warning C4103: 'depends\boost\config\abi_prefix.hpp' : alignment changed after including header, may be due to missing #pragma pack(pop)

I know I can do a #pragma to disable the warning, but I'd like to know the reason for these warnings.

like image 430
Brian R. Bondy Avatar asked Dec 31 '08 20:12

Brian R. Bondy


1 Answers

The reason is that boost doesn't push/pop these pragmas in every file that needs data to be packed. They #include a separate file which does the push (abi_prefix.hpp), and then another (abo_suffix.hp) afterwards which does the pop.

That allows them to reuse the same #pragma pack code everywhere, which is handy as it may vary between compilers.

It's perfectly safe though. The #pragma push is followed by a pop, it's just included from a different file. So you should probably just disable that error.

like image 67
jalf Avatar answered Nov 06 '22 15:11

jalf