This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Question about "#pragma pack(n)" and "-fpack-struct"
- From: James E Wilson <wilson at specifixinc dot com>
- To: feng qiu <fengqiu_tianjin at hotmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 10 Mar 2005 12:21:04 -0800
- Subject: Re: Question about "#pragma pack(n)" and "-fpack-struct"
- References: <BAY16-F28D488EF09AFEE7794C4888500@phx.gbl>
feng qiu wrote:
> When I compile with "gcc" ,the output is 6.But the output is 5 when
> using "-fpack-struct" to build,and the "#pragma pack(2)" seems to be
> invalid.What is the reason?
-fpack-struct and #pragma pack(2) are contraditctory instructions, and
-fpack-struct wins. It was never the intent to allow both. Current
gcc sources will give a warning saying that the pragma pack is being
ignored. If you want some structures that aren't fully packed, then you
can't use -fpack-struct.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com