At 12:00am -0700 00-07-29, Palm Developer Forum digest wrote:
>Richard Anderson <[EMAIL PROTECTED]> wrote:
>
>  > Anyone know why sometimes the compiler gives the error
>
>*Which* compiler?
>
>  > PS - The compiler also does not handle even word alligment 
>correctly - ie if
>  > you point a UInt 16 * at an odd address and read it you get a bus error. Im
>  > sure that the complier should handle this !!!
>
>I'm sure that it should not. When I create a pointer to something, then
>dereference that pointer, the compiler had better not change the value
>of the pointer behind my back!
>
>Pointers in C are like a high-powered rifle: very useful in the hands
>of a skilled marksman, but not too smart about what they're pointed at.

Just to clarify, the 68K core used by all current Palm devices does 
not handle word (or long) accesses to odd addresses. I've never seen 
a compiler that would automagically generate code to check whether an 
address is odd or even before attempting word/long accesses, and 
inject byte-access code for you.

What compilers have you used in the past that would do this sort of 
thing, and what were the target CPUs?

-- Ken

PS - Note that when you use the Simulator on a Mac, it does _not_ 
cause a system error when reading words/longs at odd addresses, since 
the Mac OS 68K emulator is pretending to be a 68020, which can handle 
odd address accesses. That is, unless you're a masochist and happen 
to be using the Simulator on an ancient Mac with the original 68K 
processor. Poser, on the other hand, will catch this type of run-time 
error.

Ken Krugler
TransPac Software, Inc.
<http://www.transpac.com>
+1 530-470-9200

-- 
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