Using __attribute((packed))__ on picky architectures
Darren Rook
route66@gmail.com
Fri Jan 16 17:22:00 GMT 2009
On Fri, Jan 16, 2009 at 10:59 AM, Ian Lance Taylor <iant@google.com> wrote:
>> Then why is attribute((packed)) provided? I really don't see a use
>> for it. Why not rename it to __attribute__((addressviolation))?
>
> The potential address violation only occurs when you take the address
> of a field and pass it to another function. There are many ways to
> use structures without taking the address of a field.
So my example
handle(&t.field2);
has the potential to create an address violation, but these
assignments do not(?):
t.field2 = <some value>
t->field2 = <some value>
Thanks,
Darren
More information about the Gcc-help
mailing list