>If the current tools don't support this, it might be a very nice feature >to add to the prc/code warrior compilers ASAP as 5.0 devices start showing >up and people start writing armlets.
This is a good suggestion... right now, I'm not sure of a way to get 4-byte alignment for stack variables in the 68K compiler, but I'll check with the Palm OS compiler engineer. I know you can get struct's to be 4-byte aligned using "#pragma align mac68k4byte", but I think that only affects internal alignment, not alignment on the stack. This is a good idea... I'll find about how difficult it will be to add something like #pragma align_stack NNN | reset for CW Palm OS V9. We've already done code like that in our x86 compiler -- its stack is usually 4-byte aligned, but it gets aligned to 8-bytes or 16-bytes when there are double, MMX, or SSE variables allocated on the stack. For the compiler, its just a matter of allocating an extra two bytes, setting the stack pointer, then ANDing it to get it aligned appropriately, at least when you're generating code with A6-based stack frames. If you don't have a frame pointer, doing the alignment is a bit trickier -- we'd probably just force the FP for "aligned" functions, same as how we force it for code that is in the path of a C++ exception. In the meantime, John Marshall's suggestion about doing a union and detecting the appropriate member is OK, and there are plenty of other work-arounds, as he mentioned. -- Ben Combee <[EMAIL PROTECTED]> CodeWarrior for Palm OS technical lead Palm OS programming help @ www.palmoswerks.com -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
