Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!husc6!redsox!campbell From: campbell@redsox.UUCP (Larry Campbell) Newsgroups: comp.lang.c++ Subject: Re: Improved switch statement Message-ID: <577@redsox.UUCP> Date: 18 Dec 88 16:28:55 GMT References: <6590072@hplsla.HP.COM> <1106@etive.ed.ac.uk> <33528@bbn.COM> <1907@ogccse.ogc.edu> <574@redsox.UUCP> <1988Dec18.010151.27461@utzoo.uucp> Reply-To: campbell@redsox.UUCP (Larry Campbell) Organization: The Boston Software Works, Inc. Lines: 22 In article <1988Dec18.010151.27461@utzoo.uucp> henry@utzoo.uucp (Henry Spencer) objects to the indentation I used in my example of the "if" statement present-day C++ forces you to use when you really want a "switch" statement but the argument isn't an integer or the case labels aren't constant expressions. When I wrote my article, I _knew_ someone would flame the indentation, but with the ghost of the immortal Will Strunk peering over my shoulder, I decided not to address that issue. While Henry's suggested indentation is an improvement, I still claim that no matter how you indent it, the "if" statement isn't as clear as the "switch" statement; and that a trivial relaxation of an unnecessary restriction, which does no violence to the language, can make the "switch" statement generally useful, which today it is not. (Henry's other point, about the occasional necessity of violating coding standards in certain special cases, is well taken.) -- Larry Campbell The Boston Software Works, Inc. campbell@bsw.com 120 Fulton Street wjh12!redsox!campbell Boston, MA 02146