The D Programming Language: cases (fallthrough)
Richard Harter
g-rh at cca.CCA.COM
Mon Mar 7 05:08:59 AEST 1988
In article <401 at tub.UUCP> cabo at tub.UUCP (Carsten Bormann) writes:
>In article <25200 at cca.CCA.COM> g-rh at CCA.CCA.COM.UUCP (Richard Harter) writes:
>[about a solution to get back some expressive power that will be lost if
> ``case'' implies ``break'':]
>
>(Current) C already has a good fallthrough statement.
>It is called (surprise):
>goto.
[transferring between cases goto shown.]
But, but, but... I had naturally supposed that the goto would be
dropped from D. :-)
Actually, does anyone use goto's in C to any signifigant extent?
Currently I average about one goto per 10,000 lines of code, all of them
being transfers to a procedure epilog, e.g
foobaz() {
....
allocate space and other setup
....
if (some_special_condition) goto wrapup;
....
wrapup:
deallocate space and other cleanup
}
Almost every language has a goto construct, apparently on the
principle "We know you won't use goto's, but there might be a special
case where you need one, so here it is - better to be safe than sorry."
But do people actually use it to any signifigant extent? Why not just
drop it?
--
In the fields of Hell where the grass grows high
Are the graves of dreams allowed to die.
Richard Harter, SMDS Inc.
More information about the Comp.lang.c
mailing list