Re: [stella] OT: Programming, CS theory

Subject: Re: [stella] OT: Programming, CS theory
From: Greg Miller <gmiller@xxxxxxxxxxxxxxxxx>
Date: Sat, 27 Oct 2001 02:21:49 -0500
Ben Larson wrote:

Ah the eternal struggle between GOTO-ers and
non-GOTO-ers. :)  Personally, I fall into the latter
faction. :)

Reason being, I'm pretty sure it's been proven
mathematically (by the computer scientist Edsger
Dijkstra maybe...?) that any piece of code using a
GOTO statement can always be replaced by a non-GOTO
alternative, as long as you have some looping
construct available.  Every imperative language I know

And vice-versa. Using specific constructs tends to make the meaning of the code more obvious.

of (excluding assembly language, of course) has at
least one looping construct, so why ever use GOTO?  It

One reason is that the "goto" versions are often more clear than versions that use other constructs for purposes they were not designed to accomplish. C, for example, includes no multilevel break.

just makes the code harder to read...and maintain,

One of the classic examples where goto can improve maintainability is with languages (like C) that provide insufficient cleanup mechanisms. goto is one reasonable means of avoiding duplication of cleanup code for multiple exit points. Of course, destructors in C++ do it more elegantly.

   There is no peaceful solution to organized terrorist networks.

- Archives (includes files) at Unsub & more at

Current Thread