This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.
See the CrossGCC FAQ for lots more information.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On Thu, Apr 29, 2004 at 04:48:27PM +0100, Richard Earnshaw wrote: > There seems to be some general confusion here. The thing I > was (trying) to say doesn't work is placing the address of a > packed object into a pointer to an object of the same base > type. Right. We all knew that. Nobody said it did. What I said worked was referencing the field directly: >>>test_struct.test_short = 0x1234; >>>printf("%04x\n", test_struct.test_short); >>> >>>_may_ work. I don't think it's guaranteed to work, though. > And then Bill said it was actually guaranteed to work, and after I looked up a few things, I agreed: >> Actually, I'm pretty sure it is guaranteed to work as long as >> the compiler can see the "packed" attribute during compilation > >I believe you're right. It's only when you use the "&" >operator to hide the actual structure from the compiler that >things go wrong. And then you stated not only isn't it guaranteed to work, it doesn't: > None of them. I was referring to the statement: > >> Actually, I'm pretty sure it is guaranteed to work as long as >> the compiler can see the "packed" attribute during compilation >> (if it couldn't, that would be a serious structural problem in >> your source code!). > > Which claimed it should work. It doesn't, and isn't intended > to. The statement with which you are disagreeing was that referencing the fields directly (not through a pointer) is guaranteed to work. -- Grant Edwards grante@visi.com ------ Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |