Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!cs.utexas.edu!uunet!ontek!john From: john@ontek.UUCP (John Stanley) Newsgroups: comp.lang.c Subject: Re: Oh nooo! (gotos) Summary: Maintainable code is the point. Message-ID: <550@ontek.UUCP> Date: 9 Sep 89 01:09:55 GMT References: <7598@goofy.megatest.UUCP> <12793@pur-ee.UUCP> Organization: Ontek Corporation, Laguna Hills, CA Lines: 21 In article <12793@pur-ee.UUCP>, lewie@pur-ee.UUCP (Jeff Lewis) writes: > This, I would say, is just as structured as the simple 'break' and 'continue' > that I presume most people have no problem with. Of course C doesn't offer > this obvious functionality, so you fake it with the occasional 'goto'. Is > there anything wrong with this? Absolutely not. The main objection to the use of 'goto' is when it is a substitute for careful design. It is perfectly possible to use the 'goto' statement in a structured manner, as you point out. To reject a useful language construct purely on the basis of some sort of "purity of code" fetish is quite foolish. The point here is to make careful use of what can be a most unclear construct. I am sure we have all seen code which does not have 'goto's which is quite horrible, so merely eschewing this one feature does not guarantee high quality code. Conversely, the presence of a 'goto' in a piece of code does not automatically render it unclean. :-) The argument against 'goto' was originally (I believe) an argument against the *indiscriminate* use of it in lieu of other control structures, not against the 'goto' statement itself. JAS