DON'T DO THAT !!!
68k processors are very sensitive to alignment, and any word or long on an
odd boundary will crash the processor. Also, if you use array pointers, each
element must be on an even alignment.
Therefore, you should chnage your structure by inserting a padding byte
after the Num member.
--
Eric Vergnaud
President of Street Soft
----------
>De�: "Greg Bungo" <[EMAIL PROTECTED]>
>� : <[EMAIL PROTECTED]>
>Objet�: Structure Alignment
>Date�: Mer 27 oct 1999 17:09
>
> Hello,
>
> I'm porting a program from another platform to Palm,
> and I encountered a structure alignment problem. The
> default Palm CodeWarrior alignment is "68K". This
> will make the size of a structure such as this
>
> typedef struct tagHDR
> {
> char Type[2];
> char ID[8];
> char Num[5];
> char Time[6];
> } HDR;
>
> 22 bytes rather than the expected 21 bytes.
> I changed the Struct Alignment setting in
> CodeWarrior to "PowerPC", and now this
> structure is 21 bytes. This saves me from
> rewriting some of our code, since there are places
> in the program that depend on sizeof(HDR).
>
> My question: will this change of the alignment
> setting cause problems on the Palm? If there
> is no known reason why the "68K" alignment
> type is needed, I would prefer the PowerPC
> setting, since that will save us a few bytes,
> and memory on the Palm is very precious.
>
> Thanks,
>
> Greg Bungo
>
> [EMAIL PROTECTED]
> (630)949-3250 voice
> (630)949-3299 fax
>
>
>
>
>