I haven't programmed with Code Warrior and I haven't develop anything on the
Palm either but... isn't there a debugger you can use to watch your
variables while you step through the function to see what's happening??
Since you left the option of being stupid open :-), your first 'if'
statement wouldn't happen to be:
> if (startPtP->x = endPtP->x)
instead of:
> if (startPtP->x ==endPtP->x)
The function would behave like you described if endPtP->x was equal to 0
Good Luck
Frank
p.s. we once had an 'impossible' bug a couple years back - after an if
statement just like:
if (startPtP->x == endPtP->x)
Turns out there was about 100 spaces and a <;> (on the same line - hidden
offscreen) and we were wondering why, whatever the result of the if
statement, the next line was _always_ executed...
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, September 27, 2000 02:41
Subject: An impossible error -- first correct explanation gets a prize
> The way I see it, this is impossible. Another option is that I am just
> stupid. I'll give you 2:1 odds on impossible, though. Well, maybe 1:1.
> Here goes:
>
> In my hack for the SysProcessSoftkeyStroke, the function recieves two
> parameters: PointType *startPtP and PointType *endPtP. Immediately upon
> entering the function, have the following lines:
> {
> PointType startPoint;
> PointType endPoint;
>
> if (startPtP->x == endPtP->x)
> SndPlaySystemSound(sndAlarm);
>
> startPoint = (*startPtP);
> endPoint = (*endPtP);
>
> if (startPtP->x == endPtP->x)
> SndPlaySystemSound(sndError);
> if (startPoint.x == endPoint.x)
> SndPlaySystemSound(sndError);
> }
>
> The result is no alarm, then 2 beeps. That means that startPtP.x does not
> equal endPtP.x until after I assign the variables startPoint and endPoint
> to
> the values of *startPtP and *endPtP. It gets weirder:
>
> The following code does work:
> {
> SWord startX; // for some reason, I need to save the values of startPtP
> and
> SWord startY; // endPtP and pass the address to my own PointType
> variables
> SWord endX; // if I want to call the original trap. I dont know why,
> but
> SWord endY; // it works.
>
> if (startPtP->x == endPtP->x)
> SndPlaySystemSound(sndAlarm);
>
> startX = startPtP->x;
> startY = startPtP->y;
> endX = endPtP->x;
> endY = endPtP->y;
>
> if (startPtP->x == endPtP->x)
> SndPlaySystemSound(sndError);
> if (startX == endX)
> SndPlaySystemSound(sndError);
> }
>
> Here I get no sounds whatsoever. Apparently, accessing the variables by
> reference as opposed to by value is ok, but the reverse causes them to be
> reinitialized to zero or something. I dunno.
>
> First one to figure this out gets a big prize!
>
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
> please see http://www.palmos.com/dev/tech/support/forums/
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/