Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.compilers > #1340
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!peer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED!nerds-end |
|---|---|
| From | glen herrmannsfeldt <gah@ugcs.caltech.edu> |
| Newsgroups | comp.compilers |
| Subject | Re: How to type braces for computed gotos |
| Date | Mon, 21 Jul 2014 16:19:44 +0000 (UTC) |
| Organization | Aioe.org NNTP Server |
| Lines | 48 |
| Sender | news@iecc.com |
| Approved | comp.compilers@iecc.com |
| Message-ID | <14-07-050@comp.compilers> (permalink) |
| References | <14-05-013@comp.compilers> <14-07-033@comp.compilers> <14-07-048@comp.compilers> |
| NNTP-Posting-Host | news.iecc.com |
| X-Trace | miucha.iecc.com 1405963376 57994 2001:470:1f07:1126:0:676f:7373:6970 (21 Jul 2014 17:22:56 GMT) |
| X-Complaints-To | abuse@iecc.com |
| NNTP-Posting-Date | Mon, 21 Jul 2014 17:22:56 +0000 (UTC) |
| Keywords | Fortran, history |
| Posted-Date | 21 Jul 2014 13:22:56 EDT |
| X-submission-address | compilers@iecc.com |
| X-moderator-address | compilers-request@iecc.com |
| X-FAQ-and-archives | http://compilers.iecc.com |
| X-Received-Bytes | 3077 |
| X-Received-Body-CRC | 904147994 |
| Xref | csiph.com comp.compilers:1340 |
Show key headers only | View raw
Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote: (snip) > I guess this compiler implements the labels-as-values extension of GNU > C (aka "computed goto", but see the Fortran note below). (snip) > 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"). The ASSIGN statement and assigned GOTO trace back to the original Fortran compiler, now often called Fortran I. The SUBROUTINE, CALL, and FUNCTION statements came in with Fortran II. The only subroutine call mechanism available with the Fortran I system was to ASSIGN a statement label to return to to some variable, GOTO to the subroutine, and then at the end of the subroutine GOTO back. While the computed-GOTO was also available, I suspect that the efficiency gain (both speed and code size) on a 36 bit word vacuum tube computer available, I believe, with between 8K and 32K words of magnetic core memory. But ASSIGN and the corresponding GOTO were removed from the standard as of Fortran 95. The suggested replacement is the comptued GOTO. Presumably someone should be able to write a program to automate the conversion. > Fortran also has a feature called "computed goto", but that is > closer to a C switch than a GNU C "goto *". The computed GOTO also traces back to Fortran I. It allows one to select a statement label based on an index between 1 and the number of labels available. The effect when the index variable is not in range was undefined from Fortran I through the Fortran 66 standard. Fortran 77 defined an out of range index to continue on to the following statement. The computed GOTO is on the obsolescence list, though as of Fortran 2008 still hasn't been removed. As indicated, it can be replaced by a SELECT CASE construct. But a SELECT CASE with a large number of GOTO statement has to be uglier and less readable than a computed GOTO statement. -- glen
Back to comp.compilers | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Best "simple" C Compiler I've ever seen andrewchamberss@gmail.com - 2014-05-04 18:23 -0700
Re: Best "simple" C Compiler I've ever seen federation2005@netzero.com - 2014-06-30 12:42 -0700
How to type braces for computed gotos (was: Best "simple" C Compiler I've ever seen) federation2005@netzero.com - 2014-07-18 14:44 -0700
Re: How to type braces for computed gotos glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-07-19 02:21 +0000
Re: How to type braces for computed gotos Ivan Godard <ivan@ootbcomp.com> - 2014-07-18 21:59 -0700
Re: How to type braces for computed gotos federation2005@netzero.com - 2014-07-21 10:32 -0700
Re: How to type braces for computed gotos (was: Best "simple" C Compiler I've ever seen) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-07-21 11:45 +0000
Re: How to type braces for computed gotos glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-07-21 16:19 +0000
Re: How to type braces for computed gotos wclodius@earthlink.net (William Clodius) - 2014-07-21 21:44 -0600
Re: How to type braces for computed gotos glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-07-23 00:35 +0000
Re: How to type braces for computed gotos wclodius@earthlink.net (William Clodius) - 2014-07-22 22:36 -0600
Re: How to type braces for computed gotos anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-07-25 22:38 -0400
csiph-web