Hi,
I'm a newbie to C and the Palm OS and have only recently started to write
an application with Codewarrior Lite for Mac. So far reading
through this mailing list has given me lots of tips and insights.
Now a simple multiplication in my app really confuses me. To eliminate all
other possibilities of error I added the mulitplication to a new project in
CW based on the Starter app. Even there just by adding the two lines of
code I get the same error.
All I want is to muliply 10 by 3600 ((-10 * 3600) in other cases in my
app), which should give me 36000. The variable is declared as a long, which
in the "Targeting the Palm OS".pdf says should have a range of -
2,147,483,648 to 2,147,483,647. It works fine with 9 * 3600 but anything
higher gets me a negative value. It seems to me that the limit cuts of as
if I declared my variable as an int, which I haven't ;)
The introductory text for Number Formats says to look into "limits.h" for
further information on integer types. "limits.h" isn't in my installation
of CW Lite though.
Any clues to what I'm missing here?
Following is the code of MainFormHandleEvent of the starter project I
created:
static Boolean MainFormHandleEvent(EventPtr eventP)
{
Boolean handled = false;
FormPtr frmP;
Long result;
switch (eventP->eType)
{
case menuEvent:
return MainFormDoCommand(eventP->data.menu.itemID);
case frmOpenEvent:
frmP = FrmGetActiveForm();
MainFormInit( frmP);
FrmDrawForm ( frmP);
result = 10 * 3600; // Here I get -29536 instead of 36000 when
// setting a breakpoint in the
// line below
// or 4294937760 if I declare
// result as ULong
handled = true;
break;
default:
break;
}
return handled;
}
Thanks a lot in advance
Hans
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html