Thread (1 message) 1 message, 1 author, 2003-07-25

Re: IO, ANSI vs GCC structs

flat view

From: Wolfgang Denk <hidden>
Date: 2003-07-25 16:19:35

In message [ref] you wrote:
quoted
Does GCC make guarantees beyond what ANSI requires?  Is there some
subtle detail that forces struct layout ("volatile" in the definition
perhaps)?
There is nothing that guarentees this, in ANSI or GCC.
You can use "__attribute__ ((packed))" with GCC which  guaratees  you
control  over  the  alignment  used  by the compiler (it will use the
smallest possible alignment = one byte for a variable,  and  one  bit
for  a  field,  unless  you specify a larger value with the `aligned'
attribute).


Best regards,

Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
The human race has one really effective weapon, and that is laughter.
                                                         - Mark Twain

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help