Should boost library be dependent on structure member alignments?

Posted by Sorin Sbarnea on Stack Overflow See other posts from Stack Overflow or by Sorin Sbarnea
Published on 2010-04-26T07:31:37Z Indexed on 2010/04/26 7:33 UTC
Read the original article Hit count: 350

Filed under:
|
|
|

I found, the hard way, that at least boost::program_options is dependent of the compiler configured structure member alignment.

If you build boost using default settings and link it with a project using 4 bytes alignment (/Zp4) it will fail at runtime (made a minimal test with program_options). Boost will generate an assert indicating a possible bad calling convention but the real reason is the structure member alignment.

Is there any way to prevent this? If the alignment makes the code incompatible shouldn't this be included in library naming?

© Stack Overflow or respective owner

Related posts about boost

Related posts about alignment