Re: "GOTO considered harmful" considered harmful. Re: New style DO syntax?
- From: Joe Krahn <lastname_at_niehs.nih.gov@xxxxx>
- Date: Wed, 26 Apr 2006 13:01:04 -0400
Kevin G. Rhoads wrote:
The parenthetic DO could include an end label something like this:
DO (I=1,10,END=100)
N(I)=1
100 CONTINUE
However, I would expect that all other block constructs should then have the same option for using an end label.
Fine, but then generalize the labels to be alphanumerics, perhaps terminated by a single colon.
MHOO: The main problem with goto targets in Fortran is not the GOTO, it is the numeric labels.
"GOTO considered harmful" considered harmful.
I suggested generalizing text labels some time ago, with the idea that construct names already set a precedent for using name-based labels. Many people simply dislike the idea just because it seems anti-FORTRAN. One person stated a dislike for text labels because it means having to take time to think up names for all those label numbers. With that way of thinking, why bother to name variables? You could have integers I1, I2, I3, ... In.
As for ideas like "GOTO considered harmful", there are people that take it too seriously. Things like GOTO, EQUIVALENCE and global variables are only bad when they obfuscate the code, which is easy to do if these are used excessively. Using a named label for GOTO helps keep it from being obfuscated, but useful comments can also do this.
In any case, it seems that the Fortran Standards are in the process of making block constructs more uniform, so constructive discussions here may actually have an influence.
Joe
.
- References:
- New style DO syntax?
- From: Joe Krahn
- Re: New style DO syntax?
- From: *** Hendrickson
- Re: New style DO syntax?
- From: Gordon Sande
- Re: New style DO syntax?
- From: James Giles
- Re: New style DO syntax?
- From: Gordon Sande
- Re: New style DO syntax?
- From: Joe Krahn
- "GOTO considered harmful" considered harmful. Re: New style DO syntax?
- From: Kevin G. Rhoads
- New style DO syntax?
- Prev by Date: Re: New style DO syntax?
- Next by Date: Re: New style DO syntax?
- Previous by thread: "GOTO considered harmful" considered harmful. Re: New style DO syntax?
- Next by thread: Re: "GOTO considered harmful" considered harmful. Re: New style DO syntax?
- Index(es):