Yes, this will work 100% reliably in C.
Theoretically it shouldn't work in C++ without a cast, but I haven't checked
this.
This, however, is bad coding. Don't do this. (The fact that you have to ask
this question at all shows it is bad coding).

If you need to specify a special value for an ID, use a #define and some
large number you know you will never reach/use, i.e.:

#define SPECIAL_ID   4000000000



Will

----- Original Message -----
From: "David Eyler" <[EMAIL PROTECTED]>
Newsgroups: palm-dev-forum
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Wednesday, September 04, 2002 2:21 PM
Subject: Unsigned Ints and -1


> I've been using negative one to represent a special value with unique IDs,
> which are UInt32's.  Does anyone know if it is 100% reliable to count on
the
> code below to work right?
>
> UInt32 recID = -1;
> if (recID == -1) {
>     //should be in here
> }
>
> I know when I look in the debugger and I set a unsigned Int to -1 it shows
> up as one less than its maximum value, not -1.  Thanks.
>
>
>
> --
> 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