The D Programming Language: cases

Chris Torek chris at trantor.umd.edu
Thu Mar 3 08:22:57 AEST 1988


-In article <24996 at cca.CCA.COM> g-rh at cca.CCA.COM (Richard Harter) writes:
-}As a side point, I like the suggestion that someone made that there be
-}a fallthrough statement rather than automatic fallthrough.

In article <222965b9 at ralf.home> Ralf.Brown at B.GP.CS.CMU.EDU writes:
-So, you would like to have to write
-        switch(var)
-           {
-           case foo: fallthrough;
-           case bar: fallthrough;
-           case baz: fallthrough;
-           case mung: /* code to do something for all four cases */
-           }

While this would work, if we assume D has aggregate constructors,
there is a handsomer way:

	switch (e) {
	case [1, 2, 3, 5, 7, 13, 19, 23]: ...
	}
	/* syntax above is only for demonstration */
-- 
In-Real-Life: Chris Torek, Univ of MD Computer Science, +1 301 454 7163
(still on trantor.umd.edu because mimsy is not yet re-news-networked)
Domain: chris at mimsy.umd.edu		Path: ...!uunet!mimsy!chris



More information about the Comp.lang.c mailing list