Re: How to type braces for computed gotos

wclodius@earthlink.net (William Clodius)
Mon, 21 Jul 2014 21:44:27 -0600

          From comp.compilers

Related articles
Best "simple" C Compiler I've ever seen andrewchamberss@gmail.com (2014-05-04)
How to type braces for computed gotos (was: Best "simple" C Compiler I federation2005@netzero.com (2014-07-18)
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: wclodius@earthlink.net (William Clodius)
Newsgroups: comp.compilers
Date: Mon, 21 Jul 2014 21:44:27 -0600
Organization: Compilers Central
References: 14-05-013 14-07-033 14-07-048
Keywords: Fortran, history
Posted-Date: 22 Jul 2014 10:05:47 EDT

Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:


> I guess this compiler implements the labels-as-values extension of GNU
> C (aka "computed goto", but see the Fortran note below). The type of
> a label is always void *; static typing fans might prefer a separate
> label type (or a whole type system for labels), but I guess that the
> intersection between static typing fans and the users of this
> extension is very small. I have used labels-as-values extensively and
> I have not produced errors stemming from confusion between labels and
> other occurences of void *.
>
> BTW, in Fortran this feature is called "assigned goto", and it uses
> integer variables (i.e., not a special type, either) for storing the
> labels (and therefore needs a separate syntax "assign 50 to l" instead
> of just writing "l=50"). Fortran also has a feature called "computed
> goto", but that is closer to a C switch than a GNU C "goto *".


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.


Post a followup to this message

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