"Max Bian" <[EMAIL PROTECTED]> wrote in message news:67431@palm-dev-forum...
>
> It is an interesting analogy. However, it doesn't describe the problem
> correctly.
>
> The function I cited, DmFindRecordByID, has the prototype like:
>
> Err DmFindRecordByID (DmOpenRef dbP, UInt32 uniqueID, UInt16 *indexP)
>
> And it returns 0 when it finds a record specified by ID.  So every
reasonable
> programmer will check the return before using the indexP.  It is
reasonable to
> accept eigher "found" or "not found".  People who program C get used to
all
> this.
>
> If it is an invalid ID, there has to be some specification about when to
give
> "not found" and when to give "fatal error". Otherwise, it is like the high
way
> patrolman shooting at the speeding cars at his/her random will.
>

Note, please, everybody that the API is documented to
return an error code.  Since "not found" is a likely result,
this is an error code that is very likely to be checked.

So _why_ throw the fatal error instead of letting the programmer
check the error code & recover?


--
-Richard M. Hartman
[EMAIL PROTECTED]

186,000 mi/sec: not just a good idea, it's the LAW!



-- 
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