lkml.org 
[lkml]   [2006]   [Dec]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: Subtleties of __attribute__((packed))
From
Frederik Deweerdt wrote:
> On Wed, Dec 06, 2006 at 01:20:41PM +0000, Phil Endecott wrote:
>> I used to think that this:
>>
>> struct foo {
>> int a __attribute__((packed));
>> char b __attribute__((packed));
>> ... more fields, all packed ...
>> };
>>
>> was exactly the same as this:
>>
>> struct foo {
>> int a;
>> char b;
>> ... more fields ...
>> } __attribute__((packed));
>>
>> but it is not, in a subtle way.
>>
> This is likely a gcc bug isn't it? The gcc info page states:
> Specifying this attribute for `struct' and `union' types is
> equivalent to specifying the `packed' attribute on each of the
> structure or union members.

A gcc *documentation* bug?

I asked on the gcc list about this before posting here, and although
replies are still coming in the first opinion was "it's doing exactly
what you asked it to do".

Phil.




-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-12-06 15:27    [W:0.097 / U:0.164 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site