|
John, In a message dated 97-09-23 13:40:02 EDT, you write: > I definitely do not want to get the GOTO thread going again but I > would like to share how we use GOTOs. We do much of our development > on the AS/400 using ILE C and we have created standards on how > functions are designed that include the extensive use of GOTOs, although > the GOTOs are "hidden" by the use of macros. I don't want to get the GOTO thread started again either (lest I be forced to kill someone)! However, as mentioned in previous threads regarding JAVA, my C experience has "gone by the wayside". Having worked on another platform that required GOTO's for exception handling, is the following the ONLY way to do this in ILE C? > Example (pseudocode): > > Begin Function/Subroutine > > Call/do something > CHECK_EXCEPTION(if error,ERROR1); (IF error occurred GOTO ERROR1) > > Call/do something else > CHECK_EXCEPTION(if error,ERROR2); (IF error occurred GOTO ERROR2) > EXIT; (GOTO EXIT) /* Mainline processing completed successfully */ > > ERROR1: > Handle error > EXIT; > > ERROR2: > Handle error > EXIT; > > EXIT: > Function clean up > > End Function/Subroutine > > We believe the use of GOTOs in this structured manner results in code > that is well organized (e.g., separation of mainline and error logic, > one function exit point) and much easier to read (e.g., reduces number > nested IF/THEN/ELSES) and maintain. Reserving judgement. > In the past I have had to maintain RPG programs that were loaded with > GOTOs that jumped all over the place- I would not wish that code on > anybody. Coming from a computer science background I just cannot > understand how someone can write code like that. But then again, I > look back at some of my old code and wonder what I was thinking. > > By the way, I have only encountered two cases that I can recall that > absolutely required the use of GOTOs: > 1)College program where we had to simulate recursion > 2)CL (and any other language that does not have the minimal keywords/ > op codes needed to write structured code) 2) is another example for my previous question, hence my reticence in debunking the methodolgy outright... > Structure is not a four letter word, Nor should it be... Dean Asmussen Enterprise Systems Consulting, Inc. Fuquay-Varina, NC USA E-Mail: DAsmussen@AOL.COM (for now) "Where there is an open mind, there will always be a frontier." -- Charles F. Kettering +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to "MIDRANGE-L@midrange.com". | To unsubscribe from this list send email to MAJORDOMO@midrange.com | and specify 'unsubscribe MIDRANGE-L' in the body of your message. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.