From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4b06f8f15f01a568 X-Google-Attributes: gid103376,public From: adam@irvine.com Subject: Re: Software landmines (was: Why C++ is successful) Date: 1998/08/25 Message-ID: <6rvdhv$9bv$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 384674461 References: <6rnh8p$dno$1@nnrp1.dejanews.com> <$3XHNBAxSZ41Ew4G@dowie-cs.demon.co.uk> Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Tue Aug 25 22:23:59 1998 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/3.0 (X11; I; Linux 2.0.18 i586) Date: 1998-08-25T00:00:00+00:00 List-Id: In article <$3XHNBAxSZ41Ew4G@dowie-cs.demon.co.uk>, Martin Dowie wrote: > but the arguement for not using 'goto' is that it is up to the > programmer to get it right, and that they can send the flow of > control anywhere. > > it is up to the compiler writer to get the 'return' to go to the > right place and the language defines exactly where that should be. If this is a good argument against GOTO, it's an even better argument against using assignment statements, expressions, procedure calls, and any other language constructs that actually perform any work. After all, when you use an assignment statement, look at the number of things that the programmer could get wrong. They can mistype the variable name on the left side. If the right-hand side is an expression, they could get wrong any of the variables in the right side, or the operators, or the location of parentheses, etc. I've made all these mistakes many, many times. So is using a GOTO any worse? Is the chance of getting a GOTO wrong significantly greater than the chance of screwing something else up? I sure don't see it. The most likely error is that the programmer puts the label in the wrong place. But remember what the whole "return" thing was about: one programmer said that instead of for J in 1 .. N loop if condition 1 then ... if condition 2 then ... if condition 3 then goto Continue; he would extract the code into a subroutine and use "return" instead of "goto Continue". Well, if the programmer got the location of the label CONTINUE wrong, whether via a logic error or a typo, why is it any less likely that the programmer would get the "continue" location wrong when cutting-and-pasting the code he/she wants to extract into a subroutine? The arguments against GOTO seem to keep getting lamer and more disconnected from real programming experience. -- Adam -----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum