IO, ANSI vs GCC structs
Wolfgang Denk
wd at denx.de
Sat Jul 26 02:19:35 EST 2003
In message <Pine.LNX.4.44.0307251038370.22864-100000 at spider.ancor.com> you wrote:
>
> > 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 at 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/
More information about the Linuxppc-embedded
mailing list