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] | |
> >test_struct.test_short = 0x1234;
> >printf("%04x\n", test_struct.test_short);
> >
> >_may_ work. I don't think it's guaranteed to work, though.
>
> 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.
> If you aren't sure we're right, take out the "packed" attribute and try
> again. It should work fine then. Also, stop the debugger after the
> assignment to test_pointer and examine its value: it should be 16-bit
> aligned.
IIRC, on an ARM7, it will store one byte in the "wrong" place
and leave the other byte alone.
--
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] |