Page 2 of 2
Re:C call makes exception #13 wake...
Posted: Tue Jan 04, 2005 3:15 pm
by proxy
a more reliable way to change the packing for a whole structure is like this:
(GCC Specific)
Code: Select all
#pragma pack (push, 1)
struct MyStruct {
uint16_t member1;
uint32_t member2;
};
#pragma pack(pop)
this structure will have a size of 6 which is what is wanted.
proxy
Re:C call makes exception #13 wake...
Posted: Tue Jan 04, 2005 3:32 pm
by Googles
It doesn't work for me... does it matter if I use the -O3 param when compiling.
Re:C call makes exception #13 wake...
Posted: Tue Jan 04, 2005 8:13 pm
by Colonel Kernel
Re: Packing structure members...
I use the -fpack-struct switch with GCC and it works for me.
Re:C call makes exception #13 wake...
Posted: Wed Jan 05, 2005 7:23 am
by Googles
I tried that too but GCC wouldn't even execute then...
Re:C call makes exception #13 wake...
Posted: Wed Jan 05, 2005 8:54 am
by Pype.Clicker
what sort of GCC version are you using ?
`-fpack-struct'
Pack all structure members together without holes.
*Warning:* the `-fpack-struct' switch causes GCC to generate code
that is not binary compatible with code generated without that
switch. Additionally, it makes the code suboptimal. Use it to
conform to a non-default application binary interface.
So i'd rather use a structure-local stuff than trying to pack all structures by default ...
Re:C call makes exception #13 wake...
Posted: Wed Jan 05, 2005 10:32 am
by proxy
are you sure the pragma doesn't work for you? I have never seen any case where it fails to perform as expected...perhaps you misused it?
proxy