Re: How to type braces for computed gotos

glen herrmannsfeldt <gah@ugcs.caltech.edu>
Wed, 23 Jul 2014 00:35:02 +0000 (UTC)

          From comp.compilers

Related articles
[2 earlier articles]
Re: How to type braces for computed gotos gah@ugcs.caltech.edu (glen herrmannsfeldt) (2014-07-19)
Re: How to type braces for computed gotos ivan@ootbcomp.com (Ivan Godard) (2014-07-18)
Re: How to type braces for computed gotos (was: Best "simple" C Compil anton@mips.complang.tuwien.ac.at (2014-07-21)
Re: How to type braces for computed gotos gah@ugcs.caltech.edu (glen herrmannsfeldt) (2014-07-21)
Re: How to type braces for computed gotos federation2005@netzero.com (2014-07-21)
Re: How to type braces for computed gotos wclodius@earthlink.net (2014-07-21)
Re: How to type braces for computed gotos gah@ugcs.caltech.edu (glen herrmannsfeldt) (2014-07-23)
Re: How to type braces for computed gotos wclodius@earthlink.net (2014-07-22)
Re: How to type braces for computed gotos anton@mips.complang.tuwien.ac.at (2014-07-25)
| List of all articles for this month |
From: glen herrmannsfeldt <gah@ugcs.caltech.edu>
Newsgroups: comp.compilers
Date: Wed, 23 Jul 2014 00:35:02 +0000 (UTC)
Organization: Aioe.org NNTP Server
References: 14-05-013 14-07-033 14-07-048 14-07-054
Keywords: Fortran, history
Posted-Date: 22 Jul 2014 22:31:28 EDT

William Clodius <wclodius@earthlink.net> 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


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.