In <[email protected]>, on 04/21/2012
   at 01:40 PM, Edward Jaffe <[email protected]> said:

>This is good general programming advice -- not just for COBOL
>programmers, but  for for anyone writing in any modern compiled
>language.

As defined in Alan Sherman's song "Good Advice".

>The behavior of well-defined coding structures like IF/THEN/ELSE,
>DO, SELECT,  CASE, etc. are extremely well understood--both by
>programmers and by code  optimizers no matter which language is
>being employed. This is one of the chief  reasons why structured
>programs are so much more maintainable than unstructured  ones.

Use of those constructs does not make a program well structured, and
use of goto does not make a program ill structured. You have to carve
the bird at the joints.

>Every programmer understands a-priori how the control structures
>work

Which is quite different from understanding how a particular program
using the control structure works.

>without tedious inspection of the logic to understand the possible
>paths taken.

Understanding how the *program* works can involve tedious inspection
of the logic to understand the possible paths taken even if there is
not a single goto.

>Good compiler optimization depends on the compiler understanding
>what your code  is attempting to do and structured, GOTO-less, code
>is FAR easier to optimize  than its GOTO-laden counterparts.

That's an issue for ALTER and its equivalents in other languages, not
for the GOTO itself.

>Most modern languages disallow GOTO.

FSVO modern.


>IMHO it's usually better, even when programming in older 
>languages, to avoid their use unless the language's control  
>structures are truly insufficient to handle a specific, 
>necessary case.

In most endeavors it's best to not use a hammer as a screwdriver.
 
-- 
     Shmuel (Seymour J.) Metz, SysProg and JOAT
     ISO position; see <http://patriot.net/~shmuel/resume/brief.html> 
We don't care. We don't have to care, we're Congress.
(S877: The Shut up and Eat Your spam act of 2003)

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to