Byte Alignment 1 for Code using STL
Martin v. Loewis
martin@loewis.home.cs.tu-berlin.de
Mon Jun 19 11:37:00 GMT 2000
> I'm porting some code from Windows NT 4.0 to Linux SuSE 6.3, Pentium to
> Pentium. The whole project compiles on Windows with byte alignment 1 in the
> project settings of Visual Studio. To get the same alignment on Linux, I
> added '#pragma pack(1)' a the beginning of all source file (both .cpp and
> .h). The problem I have now, is that some of the STL functions generates
> Segmentation Faults. Any idea what I do wrong???
Defining a global alignment is wrong, it will break libraries if the
structure layout changes due alignment. You can only do this in a
freestanding environment (i.e. one without any system libraries).
Regards,
Martin
More information about the Gcc
mailing list