Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!necntc!ima!haddock!karl From: karl@haddock.ISC.COM (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: goto's and switch statements -- mild proposal Message-ID: <916@haddock.ISC.COM> Date: Mon, 10-Aug-87 16:44:26 EDT Article-I.D.: haddock.916 Posted: Mon Aug 10 16:44:26 1987 Date-Received: Tue, 11-Aug-87 05:46:30 EDT References: <855@tjalk.cs.vu.nl> <2683@hoptoad.uucp> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Boston Lines: 24 In article <2683@hoptoad.uucp> gnu@hoptoad.uucp (John Gilmore) writes: >What bothers me is that I can't say ["goto default" and "goto case N"]. It's interesting that this restriction exists, in view of the oft-stated claim that the reason that switch statements have automatic fallthrough (rather than automatic breakswitch) is that "case labels are just like real labels". My own off-the-wall opinion is that "goto default" and "goto case N" should be legal; non-switch labels should have to be declared (this allows one to reduce the scope); label pointers should be allowed (with undefined effect if a goto in one function references a label from another); it should be illegal to fall into a label (one must instead write "goto foo; foo:"); and switch statements should automatically break at the end of each case (thus freeing the keyword "break" for loop exit exclusively). Oh yes, this also requires a new notation for multiple cases ("case '0'..'9':" or whatever). These are just ideas, not a serious proposal. Although they could be phased in gradually, I do not expect any of them to happen in the forseeable future. At best, some compilers/linters may introduce extensions/warnings for some of my positive/negative points. Flames are welcome, but please send them by e-mail. Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint