Path: utzoo!mnetor!uunet!mcvax!unido!tub!cabo From: cabo@tub.UUCP (Carsten Bormann) Newsgroups: comp.lang.c Subject: Re: The D Programming Language: cases (fallthrough) Message-ID: <401@tub.UUCP> Date: 5 Mar 88 16:13:39 GMT References: <222965b9@ralf.home> <2403@umd5.umd.edu> <25200@cca.CCA.COM> Reply-To: cabo@tub.UUCP (Carsten Bormann) Organization: Technical University of Berlin, Germany Lines: 34 Keywords: C case fallthrough Summary: It's there in C In article <25200@cca.CCA.COM> g-rh@CCA.CCA.COM.UUCP (Richard Harter) writes: [about a solution to get back some expressive power that will be lost if ``case'' implies ``break'':] () switch (e) { () case foo: () some code; () fallthrough; () case baz: () some more code; () } (Current) C already has a good fallthrough statement. It is called (surprise): goto. switch (e) { case foo: some code; goto baz_case; case baz: baz_case: some more code; } Any optimizer will throw away the superfluous branch implied by the goto. This also has the advantage to use the existing ``spaghetti code warning'' keyword, and to allow you to give a descriptive name for the ``baz_case''. Now if D had a comefrom... -- Carsten Bormann, Communications and Operating Systems Research Group Technical University of Berlin (West, of course...) Path: ...!pyramid!tub!cabo from the world, ...!unido!tub!cabo from Europe only.