Switch case common code
Jay Batson
jay at isis.UUCP
Thu Jun 12 01:45:22 AEST 1986
In article <134 at danews.UUCP> lvc at danews.UUCP (Larry Cipriani) writes:
>The 'best' I think that can be done is to do something like:
> switch (switch_variable)
> {
> case a: ...
> goto common;
> break;
> case b: ...
> common: common_code_for_a_and_b
> break;
> case c: ...
> break;
> }
>Gotos are usually abused, but I think the for/while stuff shown
>is just awful. I think this is a lot easier to understand. No ?
Yes. Craig, you're bright, and you've helped me lots before. But I
agree with Larry for _this_ question. But, Craig's article _was_
an interesting posting, I'm sure all will agree.
--------
"OK, so now, after it gets dark Lancelot and I will jump out of the rabbit, and
take the castle by supr........ oh."
Jay Batson
{seismo,hplabs}!hao!isis!jay
More information about the Comp.lang.c
mailing list