Sorry. Your variable is 32 bit.

But if you write 60 * 60 * 24 ... etc. the compiler (may) think these are 16
bit and try to multiply them together and get an overflow. This is what the
warning was about.

If you write (UInt32)60 * 60 * 24 ... you will force the compiler to use 32
bit for the first number, then it has to use 32 bit for the rest.

However, it is much better to use predefined constants (even if the names
are a bit confusing) since then you won't get the calculation wrong!

Matt

----- Original Message -----
From: "David Martin" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Friday, April 04, 2003 1:57 AM
Subject: RE: how to change time and date values


>
> > I think you were closer with your second attempt, you just
> > need to tell the compiler to use 32-bit integers.
> >
> > gExpiry = TimGetSeconds() + 30 * daysInSeconds;
>
>
>
> okay, I looked through the gcc manpage without finding this. I thought:
>
> UInt32 gExpiry;         // PalmTypes.h: unsigned long
>
> meant "use unsigned 32 bit integers", and for something like unix
> seconds I really,
> really meant it. What do I have to do get 32-bit integers ?
>
> thanks,
>
> David M
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/
>
>


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to