This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: struct __attribute((packed));
>>>>> "E" == E Weddington <ericw@evcohs.com> writes:
E> Paul Koning wrote:
>> It sure would be useful, though, if there were a construct that
>> does mean "pointer to packed T". In particular, I've often needed
>> "pointer to packed int" and found no way to produce that. I ended
>> up creating a one-member struct with a packed int inside, which is
>> a syntactic nightmare. (The application was a piece of legacy
>> code that was writing via int pointers, but sometimes things were
>> not aligned. The fix was much more invasive than it should have
>> been because I could find no way to define a pointer to packed
>> int.) If there IS a way to do that, it sure would be nice for the
>> docs to explain it. Right now the documentation of "packed" is
>> essentially unintellegible.
>>
>>
>>
>>
E> According to the docs here:
E> <http://gcc.gnu.org/onlinedocs/gcc-3.4.3/gcc/Type-Attributes.html#Type-Attributes>
E> what about doing something like this?:
E> ------------------------------------------- typedef int packed_int
E> __attribute__ ((aligned (1)));
E> packed_int *ppi;
That would make sense, but it has never worked for me. It seems that
attributes don't apply to type names, only to variables and members.
paul