Re: Understanding alignment in g++

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

 



Yang Zhang <yanghatespam@xxxxxxxxx> writes:

> Is there something analogous to __alignof__ that can tell me the
> required alignment?  (E.g., if I'm serializing data and trying to pack
> together everything without padding...)

As far as I know there is no way to ask for the alignment required by
the target machine.  However, if you use __attribute__ ((packed)), then
gcc will use the available instructions to retrieve the field: a
misaligned full word read if possible and appropriate, otherwise byte
reads.

Ian

[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