generalized switch
mouse at mcgill-vision.UUCP
mouse at mcgill-vision.UUCP
Sat Aug 9 20:39:08 AEST 1986
[Discussion about switch versus if/elseif]
> As I understand it, a switch/case setup compiles exactly the same as
> if (var == const1) {.....};
> else if (var == const2) {.....};
> else {default_action};
> anyway. (Or am i wrong?).
In a way. They are the same in the sense that i=i+j and i+=j are the
same. The switch expression is evaluated only once, which can be
important:
switch (*bufp++)
--
der Mouse
USA: {ihnp4,decvax,akgua,utzoo,etc}!utcsri!mcgill-vision!mouse
think!mosart!mcgill-vision!mouse
Europe: mcvax!decvax!utcsri!mcgill-vision!mouse
ARPAnet: utcsri!mcgill-vision!mouse at uw-beaver.arpa
"Come with me a few minutes, mortal, and we shall talk."
- Thanatos (Piers Anthony's Bearing an Hourglass)
More information about the Comp.lang.c
mailing list