This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: struct __attribute((packed));


>>>>> "Ralf" == Ralf Corsepius <ralf.corsepius@rtems.org> writes:

 Ralf> struct entrystruct * entry __attribute__ ((packed));

 Ralf> is interpreted as "packed pointer to struct" not as "pointer to
 Ralf> packed struct", i.e. this construct is not meaningful.

Yes it's meaningful, it may not be what you intended.

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.

    paul


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]