With the default optimization settings, CodeWarrior generates incorrect code
for simple conditional statements. (We observed the problem in CodeWarrior
Version 4.0.1, Build 0436 but have also tested it using the 3.5 SDK with
CodeWarrior 6.) The following sample produces the symptom:
#include <Pilot.h>
DWord PilotMain( Word cmd, Ptr cmdPBP, Word launchFlags)
{
UInt16 err;
err = 0;
if (err != 0)
return 1;
else
return 0;
}
With the default global optimization settings (optimize for speed, level 1),
this will cause PilotMain to bypass the test and return 1. With
optimization turned off (optimize for speed, level 0), it correctly returns
0. The project was created from a virgin "Palm VII Stationery" C project.
Of course, we can get rid of the problem by always compiling with
optimizations turned off, but that is undesirable. Is this a known problem?
It seems like a pretty basic one.
--
For information on using the ACCESS Developer Forums, or to unsubscribe, please
see http://www.access-company.com/developers/forums/