Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!usc!henry.jpl.nasa.gov!elroy.jpl.nasa.gov!gryphon!pnet02!bagpiper From: bagpiper@pnet02.gryphon.com (Michael Hunter) Newsgroups: comp.lang.c Subject: Re: New super switch, was Re: The final word on GOTO Message-ID: <20754@gryphon.COM> Date: 9 Oct 89 04:20:19 GMT Sender: root@gryphon.COM Organization: People-Net [pnet02], Redondo Beach, CA. Lines: 29 jackson@jabberwock.shs.ohio-state.edu (Michel Jackson) writes: >Press, Flannery, Teukolsky, & Vetterling remark, in their very useful >book _Numerical Recipes: The Art of Scientific Computing_ > [stuff about FORTRAN deleted] > > In C, the most dubious control structure is the switch...case...default > construction, recognizable to FORTRAN programmers as a kind of elaborate > "computed goto". Not only is the structure a confusing one, with a > bizarre "drop through" feature, it is also burdened with uncertainty, > from compiler to compiler, about what data types are allowed in its > control expression. It can virtually always be easily replaced by a > more recognizable and translatable if ...else construction. (p.13) > >I generally agree with them. Some of the most confusing code I have This is not meant as a flame, but these guys are the one who state in their intro to the C version of their book that "...we intend that all the programs should work on both mainframe, multi-user computers and on personal computers." and then use a routine to provide arrays with indices between two arbitrary index's by subracting a constant from an integer. I don't usually listen to their comments about programming. I would rather think of their code as a way to generate some numbers to test your own routines and that is usually not worth much as test cases are fairly easy to come by for most of the topics that they cover. Michael UUCP: {ames!elroy, }!gryphon!pnet02!bagpiper INET: bagpiper@pnet02.gryphon.com