are statically allocated structs always aligned to a machine word on x86/x86_64?

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

 



I didn't find any information about alignment requirements for
statically allocated objects in GCC and x86-64 manual (or I have
missed because the manual is huge). I noted that sometimes variables
such as int are not aligned on word boundary in x86 and x86_64 but I
have never seen a struct that wouldn't be allocated at address that
isn't a multiple or 4/8. I am asking this question because I would
like to know whether it's safe to assume that struct will be always
assigned at a word boundary and therefore it's possible to correctly
calculate a struct size without running a program.

This question was first asked here
https://sourceware.org/ml/libc-help/2015-08/msg00015.html but I was
told to ask it on GCC ml.
-- 
<wempwer@xxxxxxxxx>



[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