This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Byte Alignment 1 for Code using STL
- To: david_stonge at hotmail dot com
- Subject: Re: Byte Alignment 1 for Code using STL
- From: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Date: Mon, 19 Jun 2000 20:33:48 +0200
- CC: gcc at gcc dot gnu dot org
- References: <20000619123927.88819.qmail@hotmail.com>
> 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