----Original Message----
>From: E. Weddington
>Sent: 15 April 2005 17:10
> Ralf Corsepius wrote:
>> struct entrystruct * entry __attribute__ ((packed));
>>
>> is interpreted as "packed pointer to struct"
>> not as "pointer to packed struct",
>>
>>
> I would interpret it that way too: packed pointer to struct. The
> "packed" attribute is on the variable itself, not the type of the
> variable (pointer to struct)
[...snip!...]
> Yeah, if that author was thinking that the packed attribute applied to
> what the variable pointed to, then I would think that it is wrong usage
> of the attribute.
I've often wished that __attribute__s would behave like CV-quals:
char * const ptr;
== const pointer to char
struct entrystruct * __attribute__ ((packed)) entry;
== packed pointer to struct
char const * ptr;
== pointer to const char
struct entrystruct __attribute__ ((packed)) * entry;
== pointer to packed struct
I haven't done an exhaustive survey of attributes, but I know it doesn't
work that way for section attributes, and there have been times when I would
have liked it to.
cheers,
DaveK
--
Can't think of a witty .sigline today....