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. Max --- Keith Rollin <[EMAIL PROTECTED]> wrote: > At 4:24 PM -0500 11/8/01, Steven H. Schwartz wrote: > >"Peter Epstein" <[EMAIL PROTECTED]> wrote in message > >news:67388@palm-dev-forum... > >>While I heartily agree that if the docs say is returns an error code it > >>should do just that, I take exception to the ideal of returning error codes > >>rather than giving fatal errors. The problem with error codes is that it's > >>all too easy to forget to check for them, and this can lead to latent bugs. > >>By catching bugs early, the developer is freed from having to back-track to > >>figure out what went wrong. This is straight out of the book "Writing Solid > >>Code". > > > >Peter, > >You're right -- it's easy to ignore returned error codes. However, > >signalling fatal errors makes it significantly more difficult to > >debug, especially if you are debugging a non-connected handheld, > >e.g., a Clie (which CW8 still wont talk to) or IR operations. Using > >"fatal" screens is like highway patrolmen shooting out the car tires > >rather than citing the driver for an illegal right-on-red. I'd > >rather have access to a descriptive explanation of the problem. > > --Steve > > I'd like to submit a similar analogy that -- from my point of view, > anyway -- is more accurate. It's like the highway patrolmen shooting > out the tires of a speeding car rather than letting the driver drive > over a cliff. By shooting out the tires, you can possibly save the > driver and find out why he's driving like an idiot. If he goes over > the cliff, you have no idea why he's down there. > -- > > -- Keith Rollin > -- Palm OS Emulator engineer > > -- > For information on using the Palm Developer Forums, or to unsubscribe, please > see http://www.palmos.com/dev/tech/support/forums/ __________________________________________________ Do You Yahoo!? Find a job, post your resume. http://careers.yahoo.com -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
