I fixed the problem - it's not the IDE, it was just coincidence that the
line that I had the breakpoint on (the diffC =...) did not cause an
error when you stopped on it, then continued, but failed miserably when
run at "full speed". The difference lies in the treatment of pointers.
As far as I knew this should work (tho I can't recall ever doing it
quite this way before):
                Int16  * NumberTimes1Ptr, * NumberTimes2ptr
                NumberTimes1Ptr = (Int16 *) ((UInt32)rec1 + FishStr1Len
+ 1);
                NumberTimes2Ptr = (Int16 *) ((UInt32)rec2 + FishStr2Len
+ 1);
                diffC = *NumberTimes1Ptr - *NumberTimes2Ptr;

If this code, the computation of diffC would fail if either NumberTimes1Ptr or NumberTimes2Ptr were misaligned (on an odd address). Any 16-bit or 32-bit memory access on the 68K must be on an even memory boundary.


It doesn't, at least not with CW9. The following code DOES work:
                Int16   NumberTimes1, NumberTimes2
                NumberTimes1Ptr = (UInt8 *) ((UInt32)rec1 + FishStr1Len
+ 1);
                NumberTimes2Ptr = (UInt8 *) ((UInt32)rec2 + FishStr2Len
+ 1);
                MemMove(&NumberTimes1,NumberTimes1Ptr,2);
                MemMove(&NumberTimes2,NumberTimes2Ptr,2);
                diffC = NumberTimes1 - NumberTimes2;

This works because you use MemMove to copy the values into aligned memory first.


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

Reply via email to