Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.fortran > #40834 > unrolled thread

Is goto Still Considered Harmful?

Started byLynn McGuire <lmc@winsim.com>
First post2014-03-12 11:02 -0500
Last post2014-03-14 23:10 -0400
Articles 20 on this page of 101 — 40 participants

Back to article view | Back to comp.lang.fortran


Contents

  Is goto Still Considered Harmful? Lynn McGuire <lmc@winsim.com> - 2014-03-12 11:02 -0500
    Re: Is goto Still Considered Harmful? James Kuyper <jameskuyper@verizon.net> - 2014-03-12 12:17 -0400
    Re: Is goto Still Considered Harmful? nospam@see.signature (Richard Maine) - 2014-03-12 09:20 -0700
      Re: Is goto Still Considered Harmful? Lynn McGuire <lmc@winsim.com> - 2014-03-18 16:30 -0500
        Re: Is goto Still Considered Harmful? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-03-18 21:48 +0000
          Re: Is goto Still Considered Harmful? Lynn McGuire <lmc@winsim.com> - 2014-03-18 19:10 -0500
            Re: Is goto Still Considered Harmful? "Terence" <tbwright@bigpond.net.au> - 2014-03-19 20:39 +1100
            Re: Is goto Still Considered Harmful? ftinetti@gmail.com - 2014-03-19 03:41 -0700
        Re: Is goto Still Considered Harmful? ftinetti@gmail.com - 2014-03-18 16:45 -0700
        Re: Is goto Still Considered Harmful? dpb <none@non.net> - 2014-03-18 19:14 -0500
        Re: Is goto Still Considered Harmful? Geoff <geoff@invalid.invalid> - 2014-03-18 17:36 -0700
          Re: Is goto Still Considered Harmful? James Kuyper <jameskuyper@verizon.net> - 2014-03-19 07:34 -0400
            Re: Is goto Still Considered Harmful? "BartC" <bc@freeuk.com> - 2014-03-19 12:08 +0000
              Re: Is goto Still Considered Harmful? James Kuyper <jameskuyper@verizon.net> - 2014-03-19 10:07 -0400
                Re: Is goto Still Considered Harmful? Richard <rgrdev_@gmail.com> - 2014-03-19 17:05 +0100
              Re: Is goto Still Considered Harmful? Lynn McGuire <lmc@winsim.com> - 2014-03-19 12:27 -0500
                Re: Is goto Still Considered Harmful? dpb <none@non.net> - 2014-03-19 13:04 -0500
                  Re: Is goto Still Considered Harmful? dpb <none@non.net> - 2014-03-19 13:26 -0500
                    Re: Is goto Still Considered Harmful? Lynn McGuire <lmc@winsim.com> - 2014-03-19 13:36 -0500
                      Re: Is goto Still Considered Harmful? dpb <none@non.net> - 2014-03-19 14:02 -0500
                  Re: Is goto Still Considered Harmful? Lynn McGuire <lmc@winsim.com> - 2014-03-19 13:36 -0500
                Re: Is goto Still Considered Harmful? Gordon Sande <Gordon.Sande@gmail.com> - 2014-03-19 16:48 -0300
        Re: Is goto Still Considered Harmful? "Terence" <tbwright@bigpond.net.au> - 2014-03-19 20:35 +1100
          Re: Is goto Still Considered Harmful? Lynn McGuire <lmc@winsim.com> - 2014-03-19 12:26 -0500
    Re: Is goto Still Considered Harmful? Gordon Sande <Gordon.Sande@gmail.com> - 2014-03-12 13:23 -0300
      Re: Is goto Still Considered Harmful? e p chandler <epc8@juno.com> - 2014-03-12 10:05 -0700
    Re: Is goto Still Considered Harmful? Kaz Kylheku <kaz@kylheku.com> - 2014-03-12 16:47 +0000
    Re: Is goto Still Considered Harmful? "BartC" <bc@freeuk.com> - 2014-03-12 18:50 +0000
      Re: Is goto Still Considered Harmful? Gordon Sande <Gordon.Sande@gmail.com> - 2014-03-12 16:16 -0300
      Re: Is goto Still Considered Harmful? <william@wilbur.25thandClement.com> - 2014-03-12 12:49 -0700
      Re: Is goto Still Considered Harmful? "Qolin" <noone@nowhere.com> - 2014-03-12 21:54 +0000
        Re: Is goto Still Considered Harmful? Lynn McGuire <lmc@winsim.com> - 2014-03-12 16:57 -0500
          Re: Is goto Still Considered Harmful? "Qolin" <noone@nowhere.com> - 2014-03-12 22:00 +0000
            Re: Is goto Still Considered Harmful? John Harper <john.harper@vuw.ac.nz> - 2014-03-13 11:23 +1300
        Re: Is goto Still Considered Harmful? Keith Thompson <kst-u@mib.org> - 2014-03-12 15:36 -0700
        Re: Is goto Still Considered Harmful? Robert Wessel <robertwessel2@yahoo.com> - 2014-03-12 23:40 -0500
          Re: Is goto Still Considered Harmful? David Brown <david.brown@hesbynett.no> - 2014-03-13 11:25 +0100
          Re: Is goto Still Considered Harmful? Thomas Jahns <jahns@idontlikespam.dkrz.de> - 2014-03-14 11:24 +0100
            Re: Is goto Still Considered Harmful? Robert Wessel <robertwessel2@yahoo.com> - 2014-03-14 23:32 -0500
            Re: Is goto Still Considered Harmful? Dr Nick <nospam-4@temporary-address.org.uk> - 2014-03-15 13:43 +0000
              Re: Is goto Still Considered Harmful? David Brown <david.brown@hesbynett.no> - 2014-03-15 16:28 +0100
                Re: Is goto Still Considered Harmful? Dr Nick <nospam-4@temporary-address.org.uk> - 2014-03-15 16:01 +0000
                  Re: Is goto Still Considered Harmful? David Brown <david.brown@hesbynett.no> - 2014-03-17 08:51 +0100
      Re: Is goto Still Considered Harmful? David Brown <david.brown@hesbynett.no> - 2014-03-13 11:22 +0100
    Re: Is goto Still Considered Harmful? Jake <thatcadguy@gmail.com> - 2014-03-12 12:25 -0700
    Re: Is goto Still Considered Harmful? ralph <nt_consulting@yahoo.com> - 2014-03-12 15:34 -0500
    Re: Is goto Still Considered Harmful? jt@toerring.de (Jens Thoms Toerring) - 2014-03-13 01:06 +0000
      Re: Is goto Still Considered Harmful? fj <francois.jacq@irsn.fr> - 2014-03-12 18:31 -0700
        Re: Is goto Still Considered Harmful? wclodius@earthlink.net (William Clodius) - 2014-03-12 21:08 -0600
          Re: Is goto Still Considered Harmful? Dick Hendrickson <dick.hendrickson@att.net> - 2014-03-13 10:54 -0500
            Re: Is goto Still Considered Harmful? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-03-13 19:53 +0000
              Re: Is goto Still Considered Harmful? "Qolin" <noone@nowhere.com> - 2014-03-13 20:16 +0000
            Re: Is goto Still Considered Harmful? wclodius@earthlink.net (William Clodius) - 2014-03-13 21:57 -0600
      Re: Is goto Still Considered Harmful? wilson <winslole@udayton.edu> - 2014-03-13 03:59 -0400
        Re: Is goto Still Considered Harmful? wilson <winslole@udayton.edu> - 2014-03-13 05:02 -0400
      Re: Is goto Still Considered Harmful? Louis Krupp <lkrupp@nospam.pssw.com.invalid> - 2014-03-13 07:42 -0600
        Re: Is goto Still Considered Harmful? Richard <rgrdev_@gmail.com> - 2014-03-13 14:56 +0100
    Re: Is goto Still Considered Harmful? robin.vowels@gmail.com - 2014-03-13 00:59 -0700
    Re: Is goto Still Considered Harmful? Wolfgang Kilian <kilian@invalid.com> - 2014-03-13 09:10 +0100
    Re: Is goto Still Considered Harmful? Thomas Koenig <tkoenig@netcologne.de> - 2014-03-13 21:09 +0000
      Re: Is goto Still Considered Harmful? "Qolin" <noone@nowhere.com> - 2014-03-13 21:24 +0000
        Re: Is goto Still Considered Harmful? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-03-13 22:36 +0000
          Re: Is goto Still Considered Harmful? nospam@see.signature (Richard Maine) - 2014-03-13 17:54 -0700
            Re: Is goto Still Considered Harmful? robert.corbett@oracle.com - 2014-03-13 23:43 -0700
          Re: Is goto Still Considered Harmful? robin.vowels@gmail.com - 2014-03-13 18:07 -0700
          Re: Is goto Still Considered Harmful? Robert Wessel <robertwessel2@yahoo.com> - 2014-03-13 23:02 -0500
            Re: Is goto Still Considered Harmful? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-03-14 04:07 +0000
              Re: Is goto Still Considered Harmful? Robert Wessel <robertwessel2@yahoo.com> - 2014-03-13 23:56 -0500
            Re: Is goto Still Considered Harmful? helbig@astro.multiCLOTHESvax.de (Phillip Helbig---undress to reply) - 2014-03-14 09:17 +0000
          Re: Is goto Still Considered Harmful? Thomas Koenig <tkoenig@netcologne.de> - 2014-03-15 11:57 +0000
            Re: Is goto Still Considered Harmful? wclodius@earthlink.net (William Clodius) - 2014-03-15 16:38 -0600
              Re: Is goto Still Considered Harmful? Gary Scott <garylscott@sbcglobal.net> - 2014-03-15 18:09 -0500
                Re: Is goto Still Considered Harmful? wclodius@earthlink.net (William Clodius) - 2014-03-15 19:57 -0600
                  Re: Is goto Still Considered Harmful? nospam@see.signature (Richard Maine) - 2014-03-15 19:41 -0700
      Re: Is goto Still Considered Harmful? Kaz Kylheku <kaz@kylheku.com> - 2014-03-13 22:42 +0000
        Re: Is goto Still Considered Harmful? "James Van Buskirk" <not_valid@comcast.net> - 2014-03-13 17:13 -0600
          Re: Is goto Still Considered Harmful? Keith Thompson <kst-u@mib.org> - 2014-03-13 16:46 -0700
            Re: Is goto Still Considered Harmful? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-03-14 01:17 +0000
              Re: Is goto Still Considered Harmful? Robert Wessel <robertwessel2@yahoo.com> - 2014-03-13 23:04 -0500
                Re: Is goto Still Considered Harmful? David Brown <david.brown@hesbynett.no> - 2014-03-14 10:41 +0100
                  Re: Is goto Still Considered Harmful? Kaz Kylheku <kaz@kylheku.com> - 2014-03-14 09:55 +0000
                    Re: Is goto Still Considered Harmful? David Brown <david.brown@hesbynett.no> - 2014-03-14 13:16 +0100
                    Re: Is goto Still Considered Harmful? Seebs <usenet-nospam@seebs.net> - 2014-03-18 21:08 +0000
                      Re: Is goto Still Considered Harmful? James Kuyper <jameskuyper@verizon.net> - 2014-03-18 17:41 -0400
              Re: Is goto Still Considered Harmful? robin.vowels@gmail.com - 2014-03-20 03:55 -0700
          Re: Is goto Still Considered Harmful? Kaz Kylheku <kaz@kylheku.com> - 2014-03-14 00:45 +0000
            Re: Is goto Still Considered Harmful? "James Van Buskirk" <not_valid@comcast.net> - 2014-03-13 21:40 -0600
              Re: Is goto Still Considered Harmful? James Kuyper <jameskuyper@verizon.net> - 2014-03-14 01:02 -0400
                Re: Is goto Still Considered Harmful? "James Van Buskirk" <not_valid@comcast.net> - 2014-03-14 10:36 -0600
                  Re: Is goto Still Considered Harmful? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-03-14 17:30 +0000
                  Re: Is goto Still Considered Harmful? James Kuyper <jameskuyper@verizon.net> - 2014-03-14 13:51 -0400
                    Re: Is goto Still Considered Harmful? Keith Thompson <kst-u@mib.org> - 2014-03-14 13:12 -0700
              Re: Is goto Still Considered Harmful? Kaz Kylheku <kaz@kylheku.com> - 2014-03-14 05:29 +0000
                Re: Is goto Still Considered Harmful? "James Van Buskirk" <not_valid@comcast.net> - 2014-03-14 10:47 -0600
                  Re: Is goto Still Considered Harmful? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-03-14 17:43 +0000
                  Re: Is goto Still Considered Harmful? James Kuyper <jameskuyper@verizon.net> - 2014-03-14 13:52 -0400
              Re: Is goto Still Considered Harmful? Stephen Sprunk <stephen@sprunk.org> - 2014-03-16 17:15 -0500
                Re: Is goto Still Considered Harmful? Keith Thompson <kst-u@mib.org> - 2014-03-16 16:04 -0700
      Re: Is goto Still Considered Harmful? Kaz Kylheku <kaz@kylheku.com> - 2014-03-14 05:11 +0000
    Re: Is goto Still Considered Harmful? "Terence" <tbwright@bigpond.net.au> - 2014-03-14 08:32 +1100
      Re: Is goto Still Considered Harmful? Richard Damon <Richard@Damon-Family.org> - 2014-03-14 23:10 -0400

Page 1 of 6  [1] 2 3 4 5 6  Next page →


#40834 — Is goto Still Considered Harmful?

FromLynn McGuire <lmc@winsim.com>
Date2014-03-12 11:02 -0500
SubjectIs goto Still Considered Harmful?
Message-ID<lfq0fp$4dp$1@dont-email.me>
Is goto Still Considered Harmful?
 
http://www.drdobbs.com/architecture-and-design/is-goto-still-considered-harmful/240166595

Lynn

[toc] | [next] | [standalone]


#40835

FromJames Kuyper <jameskuyper@verizon.net>
Date2014-03-12 12:17 -0400
Message-ID<lfq1b2$b2u$2@dont-email.me>
In reply to#40834
On 03/12/2014 12:02 PM, Lynn McGuire wrote:
> Is goto Still Considered Harmful?
>  
> http://www.drdobbs.com/architecture-and-design/is-goto-still-considered-harmful/240166595

By some people, yes. By others, no. You were expecting this to change?
-- 
James Kuyper

[toc] | [prev] | [next] | [standalone]


#40836

Fromnospam@see.signature (Richard Maine)
Date2014-03-12 09:20 -0700
Message-ID<1lie1rb.1p06hnd8hxbwaN%nospam@see.signature>
In reply to#40834
Lynn McGuire <lmc@winsim.com> wrote:

> Is goto Still Considered Harmful?
>  
> http://www.drdobbs.com/architecture-and-design/is-goto-still-considered-
> harmful/240166595

I didn't see anything in that article that hasn't been said a zillion
times before. I'll note that, although the code shown was C, the goto
statements were used in very much the same way as most of the few gotos
that I use in my Fortran code - for an error exit.

-- 
Richard Maine
email: last name at domain . net
domain: summer-triangle

[toc] | [prev] | [next] | [standalone]


#40983

FromLynn McGuire <lmc@winsim.com>
Date2014-03-18 16:30 -0500
Message-ID<lgadtp$9s0$1@dont-email.me>
In reply to#40836
On 3/12/2014 11:20 AM, Richard Maine wrote:
> Lynn McGuire <lmc@winsim.com> wrote:
>
>> Is goto Still Considered Harmful?
>>
>> http://www.drdobbs.com/architecture-and-design/is-goto-still-considered-
>> harmful/240166595
>
> I didn't see anything in that article that hasn't been said a zillion
> times before. I'll note that, although the code shown was C, the goto
> statements were used in very much the same way as most of the few gotos
> that I use in my Fortran code - for an error exit.

We still have hundreds of thousands of lines of
F66 code in our app.  I wish most of the gotos
would just go away.  I rip a few out whenever I
get a chance but the risk of creating new bugs
is very high.

Lynn

[toc] | [prev] | [next] | [standalone]


#40986

Fromglen herrmannsfeldt <gah@ugcs.caltech.edu>
Date2014-03-18 21:48 +0000
Message-ID<lgaevv$mi4$1@speranza.aioe.org>
In reply to#40983
(comp.lang.c removed)

In comp.lang.c Lynn McGuire <lmc@winsim.com> wrote:

(snip)

> We still have hundreds of thousands of lines of
> F66 code in our app.  I wish most of the gotos
> would just go away.  I rip a few out whenever I
> get a chance but the risk of creating new bugs
> is very high.

Seems that it wouldn't be so hard for a program to go through
and find the easy cases. First, convert statement number ending
DO loops to DO/ENDDO, then where possible convert GOTO to EXIT.

Also, convert some IF/GOTO to IF/THEN and IF/THEN/ELSE.
A little harder to find IF/GOTO to convert to WHILE loops.

that might still leave many, but it could still help.

-- glen

[toc] | [prev] | [next] | [standalone]


#40990

FromLynn McGuire <lmc@winsim.com>
Date2014-03-18 19:10 -0500
Message-ID<lganas$khl$1@dont-email.me>
In reply to#40986
On 3/18/2014 4:48 PM, glen herrmannsfeldt wrote:
> (comp.lang.c removed)
>
> In comp.lang.c Lynn McGuire <lmc@winsim.com> wrote:
>
> (snip)
>
>> We still have hundreds of thousands of lines of
>> F66 code in our app.  I wish most of the gotos
>> would just go away.  I rip a few out whenever I
>> get a chance but the risk of creating new bugs
>> is very high.
>
> Seems that it wouldn't be so hard for a program to go through
> and find the easy cases. First, convert statement number ending
> DO loops to DO/ENDDO, then where possible convert GOTO to EXIT.
>
> Also, convert some IF/GOTO to IF/THEN and IF/THEN/ELSE.
> A little harder to find IF/GOTO to convert to WHILE loops.
>
> that might still leave many, but it could still help.
>
> -- glen

Yes, the DO / ENDDO is usually easy unless there
is a GOTO in the middle of the loop jumping to
the end of the loop thus going to the next
iteration.  Difficult to automate the logic.
Especially in 700,000 lines of code.

Our code is spaghetti to the max.  There are jumps
all over the place.

Lynn

[toc] | [prev] | [next] | [standalone]


#40998

From"Terence" <tbwright@bigpond.net.au>
Date2014-03-19 20:39 +1100
Message-ID<lgboko$f4p$1@dont-email.me>
In reply to#40990
Lyn noted:

>Yes, the DO / ENDDO is usually easy unless there
>is a GOTO in the middle of the loop jumping to
>the end of the loop thus going to the next
>iteration.  Difficult to automate the logic.
>Especially in 700,000 lines of code.

>Our code is spaghetti to the max.  There are jumps
>all over the place.
>
>Lynn

One trick is to automatically re-label sequentially as well as clean up (see
my other post).
The you can re-order the blocks wherever one set ends in a pure GOTO.

Then you finally re-label again, when the logical flow is pretty vertical,
or broken into  calls to subroutines.


[toc] | [prev] | [next] | [standalone]


#41001

Fromftinetti@gmail.com
Date2014-03-19 03:41 -0700
Message-ID<71f649c3-b713-40c1-86dd-01af5cb2a89e@googlegroups.com>
In reply to#40990
On Tuesday, March 18, 2014 9:10:44 PM UTC-3, Lynn McGuire wrote:
> On 3/18/2014 4:48 PM, glen herrmannsfeldt wrote:
> 
> > (comp.lang.c removed)
> >
> > In comp.lang.c Lynn McGuire <lmc@winsim.com> wrote:
> > (snip)
> >> We still have hundreds of thousands of lines of
> >> F66 code in our app.  I wish most of the gotos
> >> would just go away.  I rip a few out whenever I
> >> get a chance but the risk of creating new bugs
> >> is very high.
> >
> > Seems that it wouldn't be so hard for a program to go through
> > and find the easy cases. First, convert statement number ending
> > DO loops to DO/ENDDO, then where possible convert GOTO to EXIT.
> >
> > Also, convert some IF/GOTO to IF/THEN and IF/THEN/ELSE.
> > A little harder to find IF/GOTO to convert to WHILE loops.
> >
> > that might still leave many, but it could still help.
> >
> > -- glen
> 
> 
> 
> Yes, the DO / ENDDO is usually easy unless there
> is a GOTO in the middle of the loop jumping to
> the end of the loop thus going to the next
> iteration.  Difficult to automate the logic.
> Especially in 700,000 lines of code.

We plan a sequence of semi-automatic source code 
transformations, and GOTO elimination is several 
(I think many, I don't have an exact number) steps 
before than DO / END DO transformation. In this 
context, GOTO jumping to the end of the loop is
replaced by CYCLE (i.e. we replace it). In a more
general context, we use preconditions for source
code restructuring/transformations and we do not
combine several transformations in only one step
(e.g. the aforementioned GOTO replaced by CYCLE 
and DO / END DO).

Fernando.

> 
> Our code is spaghetti to the max.  There are jumps
> all over the place.
> 
> Lynn

[toc] | [prev] | [next] | [standalone]


#40989

Fromftinetti@gmail.com
Date2014-03-18 16:45 -0700
Message-ID<4e99a847-b9d5-4391-909f-f55f6a9a4c5e@googlegroups.com>
In reply to#40983
On Tuesday, March 18, 2014 6:30:11 PM UTC-3, Lynn McGuire wrote:
> On 3/12/2014 11:20 AM, Richard Maine wrote:
> 
> > Lynn McGuire <lmc@winsim.com> wrote:
> 
> >
> 
> >> Is goto Still Considered Harmful?
> 
> >>
> 
> >> http://www.drdobbs.com/architecture-and-design/is-goto-still-considered-
> 
> >> harmful/240166595
> 
> >
> 
> > I didn't see anything in that article that hasn't been said a zillion
> 
> > times before. I'll note that, although the code shown was C, the goto
> 
> > statements were used in very much the same way as most of the few gotos
> 
> > that I use in my Fortran code - for an error exit.
> 
> 
> 
> We still have hundreds of thousands of lines of
> 
> F66 code in our app.  I wish most of the gotos
> 
> would just go away.  I rip a few out whenever I
> 
> get a chance but the risk of creating new bugs
> 
> is very high.
> 
> 
> 
> Lynn

What is your app?

We are working on goto "elimination". Some cases seem to be "simple", but even in those
simple cases the ultimate accept/reject decision is based on strong testing.

Fernando.

[toc] | [prev] | [next] | [standalone]


#40991

Fromdpb <none@non.net>
Date2014-03-18 19:14 -0500
Message-ID<lganhl$dpf$1@speranza.aioe.org>
In reply to#40983
On 3/18/2014 4:30 PM, Lynn McGuire wrote:
...

> We still have hundreds of thousands of lines of
> F66 code in our app. I wish most of the gotos
> would just go away. I rip a few out whenever I
> get a chance but the risk of creating new bugs
> is very high.
...

What's the point unless it's an area that you're otherwise modifying 
anyway?  They're certainly not going to change behavior from what 
they've been since '66 days.

I just don't get the hysteria over them meself...

They are what they are -- the way to implement a very large part of any 
branching structure outside a simple IF or DO loop _in_the_beginning_ 
(tm).

Granted, sorry programmers wrote sorry code, but they still do so today, 
sometimes in spades.

--

[toc] | [prev] | [next] | [standalone]


#40993

FromGeoff <geoff@invalid.invalid>
Date2014-03-18 17:36 -0700
Message-ID<2kohi99ifn8opluhqi8rovcp59n050hu00@4ax.com>
In reply to#40983
On Tue, 18 Mar 2014 16:30:11 -0500, Lynn McGuire <lmc@winsim.com>
wrote:

>On 3/12/2014 11:20 AM, Richard Maine wrote:
>> Lynn McGuire <lmc@winsim.com> wrote:
>>
>>> Is goto Still Considered Harmful?
>>>
>>> http://www.drdobbs.com/architecture-and-design/is-goto-still-considered-
>>> harmful/240166595
>>
>> I didn't see anything in that article that hasn't been said a zillion
>> times before. I'll note that, although the code shown was C, the goto
>> statements were used in very much the same way as most of the few gotos
>> that I use in my Fortran code - for an error exit.
>
>We still have hundreds of thousands of lines of
>F66 code in our app.  I wish most of the gotos
>would just go away.  I rip a few out whenever I
>get a chance but the risk of creating new bugs
>is very high.
>
>Lynn
>

If it ain't broke, don't fix it, unless you can afford to replace it.

	;)

The original concept and intent of avoiding goto was to make
comprehension and maintenance easier.  If the code works and never
needs maintenance or if any maintenance of the code isn't made
difficult by its spaghetti shape, then there is no reason to refactor
unless there is confidence that regression testing will reveal any
errors that might arise as a result. 

[toc] | [prev] | [next] | [standalone]


#41003

FromJames Kuyper <jameskuyper@verizon.net>
Date2014-03-19 07:34 -0400
Message-ID<lgbvcl$tca$1@dont-email.me>
In reply to#40993
On 03/18/2014 08:36 PM, Geoff wrote:
> On Tue, 18 Mar 2014 16:30:11 -0500, Lynn McGuire <lmc@winsim.com>
> wrote:
...
>> We still have hundreds of thousands of lines of
>> F66 code in our app.  I wish most of the gotos
>> would just go away.  I rip a few out whenever I
>> get a chance but the risk of creating new bugs
>> is very high.
>>
>> Lynn
>>
> 
> If it ain't broke, don't fix it, unless you can afford to replace it.
> 
> 	;)
> 
> The original concept and intent of avoiding goto was to make
> comprehension and maintenance easier.  If the code works and never
> needs maintenance or if any maintenance of the code isn't made
> difficult by its spaghetti shape, then there is no reason to refactor
> unless there is confidence that regression testing will reveal any
> errors that might arise as a result.

I would guess that "whenever I get a chance" refers to when maintenance
is needed for other reasons; that's the same rule I use when determining
whether to make stylistic improvements to working code. And it's pretty
plausible that any code that old is indeed difficult to maintain because
of its spaghetti shape.
-- 
James Kuyper

[toc] | [prev] | [next] | [standalone]


#41004

From"BartC" <bc@freeuk.com>
Date2014-03-19 12:08 +0000
Message-ID<vNfWu.64226$Uh7.61147@fx28.am4>
In reply to#41003
"James Kuyper" <jameskuyper@verizon.net> wrote in message 
news:lgbvcl$tca$1@dont-email.me...
> On 03/18/2014 08:36 PM, Geoff wrote:

>> The original concept and intent of avoiding goto was to make
>> comprehension and maintenance easier.  If the code works and never
>> needs maintenance or if any maintenance of the code isn't made
>> difficult by its spaghetti shape, then there is no reason to refactor
>> unless there is confidence that regression testing will reveal any
>> errors that might arise as a result.
>
> I would guess that "whenever I get a chance" refers to when maintenance
> is needed for other reasons; that's the same rule I use when determining
> whether to make stylistic improvements to working code. And it's pretty
> plausible that any code that old is indeed difficult to maintain because
> of its spaghetti shape.

If it really was spaghetti code, then yes.

But if the gotos were used sensibly to construct missing control statements, 
then it might be possible to derive those by some analysis.

-- 
Bartc 

[toc] | [prev] | [next] | [standalone]


#41008

FromJames Kuyper <jameskuyper@verizon.net>
Date2014-03-19 10:07 -0400
Message-ID<5329A488.9070105@verizon.net>
In reply to#41004
On 03/19/2014 08:08 AM, BartC wrote:
> "James Kuyper" <jameskuyper@verizon.net> wrote in message 
> news:lgbvcl$tca$1@dont-email.me...
...
>> I would guess that "whenever I get a chance" refers to when maintenance
>> is needed for other reasons; that's the same rule I use when determining
>> whether to make stylistic improvements to working code. And it's pretty
>> plausible that any code that old is indeed difficult to maintain because
>> of its spaghetti shape.
> 
> If it really was spaghetti code, then yes.
> 
> But if the gotos were used sensibly to construct missing control statements, 

Such code can still be hard to maintain - there's a legitimate reason
why those control statements were added to later versions of Fortran.

[toc] | [prev] | [next] | [standalone]


#41009

FromRichard <rgrdev_@gmail.com>
Date2014-03-19 17:05 +0100
Message-ID<8738ienphl.fsf@gmail.com>
In reply to#41008
James Kuyper <jameskuyper@verizon.net> writes:

> On 03/19/2014 08:08 AM, BartC wrote:
>> "James Kuyper" <jameskuyper@verizon.net> wrote in message 
>> news:lgbvcl$tca$1@dont-email.me...
> ...
>>> I would guess that "whenever I get a chance" refers to when maintenance
>>> is needed for other reasons; that's the same rule I use when determining
>>> whether to make stylistic improvements to working code. And it's pretty
>>> plausible that any code that old is indeed difficult to maintain because
>>> of its spaghetti shape.
>> 
>> If it really was spaghetti code, then yes.
>> 
>> But if the gotos were used sensibly to construct missing control
>> statements, 

Idiots will tell you that's not possible. As someone with years
assembler not only is it done, it must be done or, yes, its hard to maintain.

>
> Such code can still be hard to maintain - there's a legitimate reason
> why those control statements were added to later versions of Fortran.

Its just as hard if not harder to keep in your head the multiple ways a
function can fall through to a single return statement. It's nonsense to
insist on one return statement.

if(c) then {
      prepare_stuff(;
      return INITIAL_SETUP_COMPLETE;
}else if(d){
      return ALREADY_DONE
}

return BLAH;

Simple but sometimes we need to keep it simply. A lot of time
maintaining live code bases we need to step through code and explicit
returns like that make it a LOT simpler to follow.

Too much theory over practice with no reference to real development and
maintenance tools makes a pretty shitty and useless team member.

-- 
"Avoid hyperbole at all costs, its the most destructive argument on
the planet" - Mark McIntyre in comp.lang.c

[toc] | [prev] | [next] | [standalone]


#41011

FromLynn McGuire <lmc@winsim.com>
Date2014-03-19 12:27 -0500
Message-ID<lgck3f$104$2@dont-email.me>
In reply to#41004
On 3/19/2014 7:08 AM, BartC wrote:
> "James Kuyper" <jameskuyper@verizon.net> wrote in message news:lgbvcl$tca$1@dont-email.me...
>> On 03/18/2014 08:36 PM, Geoff wrote:
>
>>> The original concept and intent of avoiding goto was to make
>>> comprehension and maintenance easier.  If the code works and never
>>> needs maintenance or if any maintenance of the code isn't made
>>> difficult by its spaghetti shape, then there is no reason to refactor
>>> unless there is confidence that regression testing will reveal any
>>> errors that might arise as a result.
>>
>> I would guess that "whenever I get a chance" refers to when maintenance
>> is needed for other reasons; that's the same rule I use when determining
>> whether to make stylistic improvements to working code. And it's pretty
>> plausible that any code that old is indeed difficult to maintain because
>> of its spaghetti shape.
>
> If it really was spaghetti code, then yes.
>
> But if the gotos were used sensibly to construct missing control statements, then it might be possible to derive those by some analysis.

I was working on a 6,000 line subroutine the other
day with a goto from line 5000 to line 2000.  Talk
about a context change for a looping mechanism.

Lynn

[toc] | [prev] | [next] | [standalone]


#41012

Fromdpb <none@non.net>
Date2014-03-19 13:04 -0500
Message-ID<lgcm6h$brm$1@speranza.aioe.org>
In reply to#41011
On 3/19/2014 12:27 PM, Lynn McGuire wrote:
> On 3/19/2014 7:08 AM, BartC wrote:
...

...[followups trimmed to clf only]...

>> But if the gotos were used sensibly to construct missing control
>> statements, then it might be possible to derive those by some analysis.
>
> I was working on a 6,000 line subroutine the other
> day with a goto from line 5000 to line 2000. Talk
> about a context change for a looping mechanism.
...

Why, necessarily?  What would its functional replacement be, a

DO WHILE(cond)
   ...
END

over the same block, maybe?

That's the kind of thing I've seen zillions of times in the 
roughly-of-same-vintage code I worked on for years of also roughly the 
same size as your LOC counts (the size you needed a forklift to move the 
stacks of greenbar, yes)...

If so, what's really any different?  IMO it often really makes little if 
any fundamental difference other than in some aesthetic sense _unless_ 
you've got the time/resources to actually _seriously_ refactor the whole 
thing to get the complexity of the overall subroutine down.

--

[toc] | [prev] | [next] | [standalone]


#41013

Fromdpb <none@non.net>
Date2014-03-19 13:26 -0500
Message-ID<lgcnfm$fe0$1@speranza.aioe.org>
In reply to#41012
On 3/19/2014 1:04 PM, dpb wrote:
...

> ... What would its functional replacement be, a
>
> DO WHILE(cond)
> ...
> END
>
> over the same block, maybe?
>
...

> If so, what's really any different..._unless_
> you've got the time/resources to actually _seriously_ refactor the whole
> thing to get the complexity of the overall subroutine down.

Which makes me really shudder when I think of trying to maintain the 
same code after an automagic conversion to C++ that I understand you're 
planning as a longterm direction.

--

[toc] | [prev] | [next] | [standalone]


#41015

FromLynn McGuire <lmc@winsim.com>
Date2014-03-19 13:36 -0500
Message-ID<lgco52$471$2@dont-email.me>
In reply to#41013
On 3/19/2014 1:26 PM, dpb wrote:
> On 3/19/2014 1:04 PM, dpb wrote:
> ...
>
>> ... What would its functional replacement be, a
>>
>> DO WHILE(cond)
>> ...
>> END
>>
>> over the same block, maybe?
>>
> ...
>
>> If so, what's really any different..._unless_
>> you've got the time/resources to actually _seriously_ refactor the whole
>> thing to get the complexity of the overall subroutine down.
>
> Which makes me really shudder when I think of trying to maintain the same code after an automagic conversion to C++ that I understand
> you're planning as a longterm direction.

Those gotos will go straight across to C and
C++ <grin>.

Lynn

[toc] | [prev] | [next] | [standalone]


#41016

Fromdpb <none@non.net>
Date2014-03-19 14:02 -0500
Message-ID<lgcpjs$l1t$1@speranza.aioe.org>
In reply to#41015
On 3/19/2014 1:36 PM, Lynn McGuire wrote:
> On 3/19/2014 1:26 PM, dpb wrote:
...

>> Which makes me really shudder when I think of trying to maintain the
>> same code after an automagic conversion to C++ that I understand
>> you're planning as a longterm direction.
>
> Those gotos will go straight across to C and C++ <grin>.

Yeah, w/ all the added complexity of the rest of the language syntax to 
further compound the visual scanning of the code.  <wry sorta' grin>

Maybe tools have improved, I've had the experience once't upon a time 
many years ago of having inherited such a piece from ORNL on a contract 
job to add an additional function to it.  I eventually requested 
contractual relief to go back to the original FORTRAN source to do the 
mod's and let them retranslate _that_ back to the C to meet the then 
current _edict_of_the_day_ (tm).

--

[toc] | [prev] | [next] | [standalone]


Page 1 of 6  [1] 2 3 4 5 6  Next page →

Back to top | Article view | comp.lang.fortran


csiph-web