Maybe goto is just a branch in some languages, but certainly not in any language with an Algol 60 flavor, e.g., PL/I.
As for using goto for control structures, there are valid use cases. If you use a screwdriver to pound in a nail, don't blame the screwdriver for the poor results. -- Shmuel (Seymour J.) Metz http://mason.gmu.edu/~smetz3 ________________________________________ From: IBM Mainframe Discussion List <[email protected]> on behalf of David Crayford <[email protected]> Sent: Sunday, January 14, 2018 1:29 AM To: [email protected] Subject: Re: curious: Popularity & use of C on z/OS. On 14/01/2018 2:18 AM, Paul Gilmartin wrote: >> ... >> I prefer implicit destruction of resources. It takes careful programming >> in C to handle errors and free resources that usually requires lots of >> code. I've always found the best way >> to do that in C is a goto that branches to a cleanup block but oddly >> that seems to be banned by most company coding standards. ... >> > "break" almost suffices. Alas, C, unlike Rexx, provides no way to exit a > specific block. > > An alternative is a wrapper procedure: > acqire resources > call main body code > cleanup Not as clean as a goto, especially in deeply nested code. Using goto for control structures is poor practice but for error handling in languages that don't support exceptions it remains the best solution. Exceptions, break, continue are just syntactic suger for goto. ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
