HP3000-L Archives

March 2004, Week 2

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Bruce Collins <[log in to unmask]>
Reply To:
Bruce Collins <[log in to unmask]>
Date:
Fri, 12 Mar 2004 15:30:44 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (70 lines)
In "The C Programming Language" Kernighan and Ritchie, mention that goto is
"infinitely-abusable" but there are a few cases where it may have it's
place.

For example, when breaking out of a deeply nested structure in the event of
some sort of disaster:

for ( .....)
   for ( ... )
   {   .........
      if ( disaster )
        goto error;
   }

error:
     clean up the mess

And even in this case they suggest that it is only worthwhile if the error
handling is non-trivial.

In C Programming Guidelines, Thomas Plum recommends that the goto statement
should never be used "for the empirical reason that its use is highly
correlated with errors and hard to read code, and for the abstract reason
that algorithms should be expressed in structures that facilitate checking
the program against the structure of the underlying process.

You also mentioned the Speedware programming language with a "??". Speedware
has a particularly nasty form of goto (GO field;), which allows you to GO to
a particular field on a screen based on some conditions. With this statement
however, Speedware will actually execute all the code that you pass over
between the GO statement and the field that you go to (assuming you are
going forward to a field after the GO statement). It can cause a lot of
grief to an unwary programmer.



----- Original Message -----
From: "KENT WALLACE" <[log in to unmask]>
To: <[log in to unmask]>
Sent: Thursday, March 11, 2004 6:52 PM
Subject: [HP3000-L] GO TO


Hmmmm

I was told in 1986 when I worked at Boeing, never to use "GO TO"'s.  I have
had this discussion off the list.  I have written a few languages and have
compiled the following list.

Language     USE of "GO TO"

COBOL         It's a sin, some use it to exit paragraph but I won't.
PASCAL        Never
C                  Never
COGNOS      There is not one!
ADA              Never, poor coding practice
VB .NET        Use EXIT SUB, IF etc...(never)
FORTRAN     Yes
SPEEDWARE ??


Thanks
Kent Wallace

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2