This is speculation, but perhaps it would work if you reversed the order
of the operands, and also type casted. Try:
if(nMyResult == ((Int16)-1))
{
// do some funky stuff
}
Just a thought.> -----Original Message----- > From: [EMAIL PROTECTED] [mailto:bounce-447935- > [EMAIL PROTECTED] On Behalf Of Bryce Burrows > Sent: Wednesday, July 13, 2005 3:09 AM > To: Palm Developer Forum > Subject: -1 madness? > > hello > Using PODS , i have a function i return the int value -1 from > > int MyGroovyFunction() > { > int nMyReturnValue =0; > // do some funky work and for a very good reason set the following > nMyReturnValue = -1; > > return nMyReturnValue; > } > > ok nothing terribly exciting there (well not in my experience anyway) > > In the code which picks up the return value > > e.g. > > int nMyResult = MyGroovyFunction(); > > the value for nMyResult is not -1 as one would expect but rather 65535. - > yes and i know that 2^16 = 65536 and all that > > > now, after the assignment i have a conditional (as infact the function > doesnt always return -1 in real life..just today's example) > > if (-1 == nMyResult) > { > //do some funky stuff > } > > this of course fails as nMyResult has been giventhe value 65535... > so i change the conditional to > > if (65535 == nMyResult) > { > //do some funky stuff > } > > which i would have expected to work, but it doesnt and i was wondering if > one of you kind people could point out what i'm missing...PODS is my first > experience with the GNU compiler and i'm more used to the M$ version. > > many thanks and best regards > > Bryce > > > > > > > > > -- > For information on using the PalmSource Developer Forums, or to > unsubscribe, please see http://www.palmos.com/dev/support/forums/ -- For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
