public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* are statically allocated structs always aligned to a machine word on x86/x86_64?
@ 2015-08-21 18:39 john smith
  2015-08-21 18:49 ` Jonathan Wakely
  0 siblings, 1 reply; 9+ messages in thread
From: john smith @ 2015-08-21 18:39 UTC (permalink / raw)
  To: gcc-help

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@gmail.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-08-23 15:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-21 18:39 are statically allocated structs always aligned to a machine word on x86/x86_64? john smith
2015-08-21 18:49 ` Jonathan Wakely
2015-08-21 19:31   ` john smith
2015-08-22 23:16     ` Jonathan Wakely
2015-08-23 11:05       ` Segher Boessenkool
2015-08-23 13:49         ` Jonathan Wakely
2015-08-23 13:52           ` Jonathan Wakely
2015-08-23 15:19           ` Segher Boessenkool
2015-08-23 15:23             ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).