Re: aligned attribute

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

 



Maurizio Vitale writes:
 > But when I move to my real application (an event-driven simulator) I  
 > get stack allocated objects on 8-byte boundaries.
 > 
 > Now, my reading of the documentation is that the aligned attribute  
 > (when used for types, as in the example I gave) applies to all  
 > allocations (global, auto and heap). Is there any place where it is  
 > said otherwise? Regardless of the documentation, what does the  
 > implementation do?

You can't get alignment any greater than the alignment of the stack
pointer.  The alignment of the stack pointer is defined the the ABI of
the particular target you're using.  I think it's 16 for x86
processors, but the processor itself doesn't enforce that: it varies
across operating systems and processor variants.

 > This lead me to believe that every time a variable of type S is
 > allocated, the requested alignment is used (modulo linker
 > limitations of above).

Sure, but that only really applies to statically allocated objects.  I
guess no-one appreciated that someone might want to use it for
auto variables.

Andrew.

[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