given:
UInt16 x = -1;
Int16 y = -1;
The value stored is exactly the same in both cases, but x will appear to be
65535 and y will appear to be -1.
There is actually nothing wrong with saying the function returns -1 (which
if unsigned is == 65535) if the resource is not found, except that it may be
confusing.  When testing the return value of DmFindResource, it won't hurt
to do
    if ( (Int16)result == -1 ) ...
but I don't think it is necessary.  (Of course, some compilers may behave
differently.)

----- Original Message -----
From: "Norris Pouhovitch" <[EMAIL PROTECTED]>
Newsgroups: palm-dev-forum
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Thursday, October 05, 2000 1:14 PM
Subject: DmFindResource


> I am having a little trouble reading this DmFindResource function
> documentation, it says that it returnes an unsigned integer, however it
> also says that -1 indicates that the record was not found. Am I to assume
> that it is a Signed integer being returned rather then unsigned?
> Should I do a cast to (Int16) on the result?
>
> I have checked in the SDK definitions and the function does return UInt16.
>
> Any comments on this documentation booboo will be appreciated :)
>
> THE FOLLOWING IS AN EXCERPT FROM THE SDK DOCUMENTATION:
>
> UInt16 DmFindResource (DmOpenRef dbP, DmResType resType,
>         DmResID resID, MemHandle resH)
>
>     Parameters
>
>         -> dbP
>         -> resType
>         -> resID
>         ->resH
>
>     Result
>         Returns index of resource in resource database, or -1 if not
found.
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/
>


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

Reply via email to