Topic: The "switch" statement


Author: cbusch@ub.d.umn.edu (Mmmm...)
Date: 26 Oct 92 04:35:50 GMT
Raw View

Hello

The switch statement is VERY weak in C/C++.  I was wondering
if the new C++ standard would improve on switch.  I realize
one can use if...else statements in a chain to get the same
effect as a stronger switch, but this is very annoying and
tiresome.  The point of a high-level language is to remove
burden from the programmer, not place it on the person!  A massive
improvement in switch would be to allow it to be used with all types.
The switch statement could automatically call an overloaded == operator
so it could evaluate the case statements.  In addition, the keyword
case should be allowed to have variables.  These improvements would
ease many programming situations - making code more readable and
more readily available to optimizations.

-Chris Busch