Re: sizeof and allignment on 32bit target

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Fri, Jul 25, 2003 at 10:13:30AM +0200, Eric de Jong wrote:
>    struct TestStruct
>    {
>       struct
>       {
>          unsigned long Value1;
>          unsigned long Value2;
>          unsigned short Value3;
>       } Value;
>       unsigned long Value4;
>    } Test;

if you should get those 10 you have to add packed attribute to the struct
definition:

    struct TestStruct
    {
       struct
       {
          unsigned long Value1;
          unsigned long Value2;
          unsigned short Value3;
       } Value __attribute__ ((packed));
       unsigned long Value4;
    } Test __attribute__ ((packed));

otherwise the alignment will be always 4 bytes for any structure.

-ziza



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux