Richard Anderson <[EMAIL PROTECTED]> wrote:

> On the pointer front:
> 
> I dont expect the compiler to change the pointer but take this 
example
> (psudo addresses):
> 
> I receive 3 bytes of serial data and place them at address 0x100
> 
> if my data is infact:
> 
>  struct {
>       char a;
>       word b;
> } mystruct;
> 
> And I have a pointer to mystruct overlayed on my serial data
> 
> mystruct *ptr = 0x100;
> 
> and do :    word c = *mystruct->b       then you get a bus error as 
the
> compiler does a move.w over a odd boundary.
> What it should do is 2 * move.b and recombine the result 
transparently to
> the C user. Other 68K compiler I have used do this.

Ah, okay. Are you sure about the two move.b instructions? Most 
compilers I've seen that are targetted to architectures requiring even 
address for multi-byte accesses accomplish such safety by adding a byte 
of padding as necessary within structs, so that multi-byte elements are 
on even addresses. There should be an option somewhere in the CW 
settings to make it do this.

--
Roger Chaplin
<[EMAIL PROTECTED]>

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to