Path: utzoo!mnetor!uunet!husc6!linus!necntc!ima!haddock!karl From: karl@haddock.ISC.COM (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: The D Programming Language: cases Message-ID: <3120@haddock.ISC.COM> Date: 22 Mar 88 23:11:19 GMT References: <25200@cca.CCA.COM> <3278@okstate.UUCP> <336@wsccs.UUCP> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Boston Lines: 28 In article <336@wsccs.UUCP> terry@wsccs.UUCP (terry) writes: >I think that [an explicit fallthrough statement] would be dangerous, in that >it would have further reaching effects than Richard anticipates. Since the >discussion centers around 'D', which by context is simply "a new standard C >which may not be compatable with the current K&R standard of C so we'll call >it 'D'", I believe that "upward" compatability must be maintained if all C >software is to be recompiled in D with minimal tweaking. That sounds more like a description of ANSI C. "D" is intended to be a language which is as powerful as C but (unlike ANSI C and C++) is *not bound at all* by the compatibility requirement. (Although a C-to-D translation tool would probably appear, in the unlikely event that this thought experiment actually materializes into something tangible.) >While a change this drastic _could_ be worked around with something as simple >as #define case fallthrough; case this does _not_ help code generators >such as YACC and LEX generate this new code. What's the problem? I think yacc currently generates a break after each case block; the solution then is to omit this if generating D. Even if yacc does depend on the current automatic fall-through semantics, it could generate an explicit "fallthrough;" statement at the bottom of each case block. Surely it has enough information for this -- I'd bet it's a one-line change. (Btw, although I would prefer a "fallthrough" statement to the current C semantics, I think that both are inferior to "goto case N".) Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint