For starters don't trust the Metrowerks Codewarrior debugger!
If you have *any* optimisation turned on and debug code, the debugger
will do stupid things (it will appear to skip code and not set variables
correctly etc). However it's just because the debugger is broken. I find
that actual code usually executes correctly - it just *looks* like it's
broken.
Are you sure the problem you're seeing is not just a debugger artifact?
Stuart Nicholson
Programmer
Firepad Inc.
-----Original Message-----
From: Charles Rezsonya [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 14, 2000 11:49 AM
To: Palm Developer Forum
Subject: Attn: MetroWorks CW, Annoying optimization issue
i have a small chunk of code which i was wondering why it wasn't
working. i
have the projects debugging level 1 up from "no optimizations". when i
place some frmCustomAlerts, a calculation is made, and some numbers are
assigned to ulongs. but when i remove the customAlerts, it totally
skips
the calculation which is importent. so i tried putting the
optimizations to
none and see what it does and now it does it. can anyone bring up
anything
that might cause this bug? i say bug, because an optimizer isn't
supposed
to skip lines of code.
Word CheckXORAdjustData(ULong serverDate, UShort offSet) {
ULong curDate;
ULong offSetSec;
ULong dateDiff;
curDate=TimGetSeconds(); // get units time in seconds
if(curDate==serverDate) { // if seconds match then exit
return 0;
}
offSetSec=offSet*60; // get offset in seconds
if(curDate>serverDate) {
// FrmCustomAlert(TestAlert, "TEST", " ", " "); // <---- these
two
lines if removed make the entire if statement skipped
dateDiff=curDate-serverDate;
} else {
// FrmCustomAlert(TestAlert, "TEST2", " ", " "); // <---- these
two
lines if removed make the entire if statement skipped
dateDiff=serverDate-curDate;
}
if(dateDiff>offSetSec) {
TimSetSeconds(serverDate);
return 2;
}
return 1;
}
--
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/