struct __attribute((packed));
E. Weddington
ericw@evcohs.com
Fri Apr 15 16:28:00 GMT 2005
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.
>
>
>
>
According to the docs here:
<http://gcc.gnu.org/onlinedocs/gcc-3.4.3/gcc/Type-Attributes.html#Type-Attributes>
what about doing something like this?:
-------------------------------------------
typedef int packed_int __attribute__ ((aligned (1)));
packed_int *ppi;
-------------------------------------------
Eric
More information about the Gcc
mailing list