Question about "#pragma pack(n)" and "-fpack-struct"

feng qiu fengqiu_tianjin@hotmail.com
Tue Mar 8 13:04:00 GMT 2005


Hello!

Consider the following simple code.

#pragma pack(2)
struct TEST{
	char	x1;
	int	x2;	
};
#pragma pack()
main()
{
	struct TEST	t;
	printf("%d\n", sizeof(t));
}
 
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?
Is there anyway to combine them?If I want to modify the gcc source 
code,what should I do?

Thanks in advanced,
Diterlish

_________________________________________________________________
Ãâ·ÑÏÂÔØ MSN Explorer:   http://explorer.msn.com/lccn/  



More information about the Gcc mailing list