At 10:12 AM +0100 4/20/01, Richard Anderson wrote:
>...I think its much simpler to have
>a label at the end of the function, and use (gasp) a "goto" statement. Shock
>Horror, but isnt this all try and catch effectively does ???

Yup. And that's pretty much how they're implemented too.


>Admittably I dont do this very often, for fear of my collegues looking at my
>code, and the abuse which I would recieve. But in things such as a
>Open_CommPort type function, where you need to check the return values of
>about 8 functions, and handle any errors, "goto error_label" is spot on.

And that's exactly how it should be used too; as a common [error-handling] exit point.


>(Ive actually seen a goto somewhere in Palms source code).

We have lots of 'em. Makes the code simpler and easier to read when used properly. :o)


Best Regards,

Jim Schram
Palm Incorporated
Partner Engineering


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