Path: utzoo!mnetor!uunet!husc6!cca!g-rh From: g-rh@cca.CCA.COM (Richard Harter) Newsgroups: comp.lang.c Subject: Re: The D Programming Language: cases (fallthrough) Message-ID: <25350@cca.CCA.COM> Date: 6 Mar 88 23:31:13 GMT References: <12159@brl-adm.ARPA> Reply-To: g-rh@CCA.CCA.COM.UUCP (Richard Harter) Organization: Computer Corp. of America, Cambridge, MA Lines: 41 In article <12159@brl-adm.ARPA> PEPRBV%CFAAMP.BITNET@husc6.harvard.EDU (Bob Babcock) writes: >I don't understand. First you give a perfectly reasonable example of >the use of goto (which would be awkward to code otherwise), and then >you propose eliminating goto from the language because you don't use >it very often. One of the reasons I like programming in C rather than >(pre-77) Fortran is that you have the flow control constructs >necessary to eliminate abusive use of goto's, but you still have >goto available for the occasional place where it best expresses >what you want to do. My apologies for muddying the waters. Yes, there are rare occasions where a goto lets you build by hand a construct that is not available in the language. Most of these instances reflect deficiencies in the language. In the example I cited the deficiencies are: (a) C has two escape statements, break and return. 'return' escapes from the outermost containing block (the function). 'break' is a little ambiguous. By analogy one would expect it to escape from the innermost containing block. Actually, of course, it escapes from loops and switch control structures. C would be improved if it had better escape constructs. (b) C has no provision for epilogs -- an epilog being a block of code executed after an escape. I don't quite see how one puts epilogs in C in any natural fashion. The question I was raising was whether the rare instances where a goto is actually useful warrant retaining it in the language. You and I, of course, will use them wisely and only when warranted. But I could do without them in C. The times that I would have to get around not having them available are few compared to other awkwardnesses in the language. Incidentally, the objection I have to older Fortran is not so much the abusive use of goto's (a complaint I will leave to theoreticians) but is their awkwardness -- expressing any kind of complicated logic in Fortran 66 is rather like solving a chinese box puzzle. -- In the fields of Hell where the grass grows high Are the graves of dreams allowed to die. Richard Harter, SMDS Inc.