problems/risks due to programming language, stories requested

Gianfranco Ciardo ciardo at software.org
Fri Mar 9 07:44:48 AEST 1990


In article <Mar.8.10.19.49.1990.3812 at atanasoff.rutgers.edu> lou at atanasoff.rutgers.edu (Lou Steinberg) writes:
> > >> A multi-case switch is very handy in many situations to reduce identical
> > >> treatments for similar cases.  
> ARGHHH!!  That is what subroutines (and macros) are for - to handle
> common code.  And if your language makes them too expensive, either in
> terms of run time or in terms of programmer effort, then THAT is an
> even worse problem with the language than the problems with break.

I think you miss completely the point.
Using subroutines is not going to help you make the code shorter, more compact,
or less repetitious (which is not) in a case like this:

          switch (what_to_do) {
                    case FIVE_THINGS:
                            <statementA>;
                    case FOUR_THINGS:
                            <statementB>;
                    case THREE_THINGS:
                            <statementC>;
                    case TWO_THINGS:
                            <statementD>;
                    case ONE_THING:
                            <statementE>;
                    case NOTHING:
                            break;
          }



More information about the Comp.lang.c mailing list