This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: memcpy to an unaligned address
On 8/2/05, Paul Koning <pkoning@equallogic.com> wrote:
> One of the things that continues to baffle me (and my colleagues) is
> the bizarre way in which attributes such as "packed" work when applied
> to structs.
>
> It would be natural to assume, as Shaun did, that marking a struct
> "packed" (or, for that matter, "packed,aligned(2)") would apply that
> attribute to the fields of the struct.
This is exactly the behaviour suggested by the info docs:
$ info gcc 'C Ext' 'Type Attr'
...
Specifying this attribute for `struct' and `union' types is
equivalent to specifying the `packed' attribute on each of the
structure or union members.
Cheers,
Shaun