Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED!nerds-end From: glen herrmannsfeldt Newsgroups: comp.compilers Subject: Re: How to type braces for computed gotos Date: Wed, 23 Jul 2014 00:35:02 +0000 (UTC) Organization: Aioe.org NNTP Server Lines: 26 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <14-07-056@comp.compilers> References: <14-05-013@comp.compilers> <14-07-033@comp.compilers> <14-07-048@comp.compilers> <14-07-054@comp.compilers> NNTP-Posting-Host: news.iecc.com X-Trace: miucha.iecc.com 1406082688 68019 2001:470:1f07:1126:0:676f:7373:6970 (23 Jul 2014 02:31:28 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Wed, 23 Jul 2014 02:31:28 +0000 (UTC) Keywords: Fortran, history Posted-Date: 22 Jul 2014 22:31:28 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: csiph.com comp.compilers:1346 William Clodius wrote: (snip on labeled variable GOTO, Fortran ASSIGNed GOTO, and such) > Not quite the rough equivalent of a C switch statement is the Fortran 90 > SELECT CASE. A Fortran computed GO TO, as with an assigned GO TO, does > not have a syntactic block associated with it, and can be set up to go > to any label within the current program or sub-program. Well, there is no rule that you have to write ugly code in Fortran. You can indent and comment, and otherwise arrange things in a more orderly way. In the case of computed GOTO, you could arrange the code for each choice one after another, in the same order as the labels, and with comments indicating which choice went to each one. If you consider something like Duff's device, then it isn't so obvious that computed GOTO is so different from C's switch/case. (Well, when the labels are sequential starting at one.) As I noted previously, the Fortran standard now considers SELECT CASE as a replacement for computed GOTO, though the latter hasn't yet been removed from the standard. -- glen