Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cca!mirror!ima!haddock!karl From: karl@haddock.ISC.COM (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: gotos and switch statements -- mild proposal Message-ID: <1022@haddock.ISC.COM> Date: Mon, 31-Aug-87 11:44:47 EDT Article-I.D.: haddock.1022 Posted: Mon Aug 31 11:44:47 1987 Date-Received: Fri, 4-Sep-87 05:24:20 EDT References: <855@tjalk.cs.vu.nl> <2683@hoptoad.uucp> <916@haddock.ISC.COM> <929@haddock.ISC.COM> <867@mcgill-vision.UUCP> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Boston Lines: 25 In article <867@mcgill-vision.UUCP> mouse@mcgill-vision.UUCP (der Mouse) writes: >In article <929@haddock.ISC.COM>, karl@haddock.ISC.COM (Karl Heuer) writes: >> In article <2182@zeus.TEK.COM> dant@tekla.UUCP (Dan Tilque) writes: >>> [switch statements with auto-break breaks "case foo: case bar: ...;"] >>> One possibility is separating them with commas: "case CR, LF:" which >>> changes the meaning of the comma operator. > >> The comma operator is neither necessary nor useful in a constant >> expression, and is explicitly disallowed by ANSI. > >[Not necessary, but possibly useful in that it might be constructed by a >general-purpose macro] Good point (even though I also fail to have an example at hand). However, the fact that it *is* currently forbidden means that the proposed syntax would be fully compatible. If ANSI later decides to legalize the comma operator in a constant expression, they could still do so. This would not conflict with the proposal -- it would simply create another reason for the macro body to be enclosed in parens. In other words, "case CR, LF:" would have the new semantics, whereas "case (CR, LF):" would be equivalent to "case LF:". This is no more problematic than the current overloading of comma for function calls. Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint