www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/08/10/15:05:56

Message-Id: <4.3.2.7.0.20000805163317.00ab5570@mail.subdimension.com>
X-Sender: matt DOT l AT mail DOT subdimension DOT com
X-Mailer: QUALCOMM Windows Eudora Version 4.3.2
Date: Sat, 05 Aug 2000 19:21:09 -0700
To: djgpp AT delorie DOT com
From: Matt Lewandowsky <matt DOT l AT techie DOT com>
Subject: Re: (OFF TOPIC) Re: BREAKing out of a nested loop
In-Reply-To: <8me2vh$6o1$1@plato.wadham.ox.ac.uk>
References: <005a01bffd43$030a3520$0500007b AT brk>
<4 DOT 3 DOT 2 DOT 7 DOT 0 DOT 20000803145250 DOT 00aa2310 AT mail DOT subdimension DOT com>
<4 DOT 3 DOT 2 DOT 7 DOT 0 DOT 20000803161722 DOT 00aa8bf0 AT mail DOT subdimension DOT com>
Mime-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

--===-=--==--==----=--=-=-----=====-----=-====--=-
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"; format=flowed

Well, I was just being my overly-paranoid, as is my habit... We don't want 
someone to think goto is the cure-all end-all of C, do we? ;) It appears 
that we agree on our views on goto, however we just took different tacks. 
I've been known to use a goto here and there. Usually to short-circuit a 
loop if a very bad thing has happened. I generally then print an error and 
abort. They generally don't stay in there long in my case, because I feel 
that it should be possible to gracefully deal with most situations.

But, we're just rehashing a dead horse. I think this thread should have 
died already, so this is my last post on it. However, I do hope that it has 
given a new programmer a few things to think about. It *has* brought up 
quite a few good points on how to avoid a situation where the only solution 
is to short-circuit. (Not graceful, IMHO.) At least it didn't degenerate 
into a "goto is good!", "no, it's not!" type thread. People actually made 
attempts to give their thoughts on the subject. This was probably a better 
thread than any I've seen in BASIC lists/groups on GOTO. And BASIC has more 
times that GOTO is justifiable. I'm impressed. :)

Welp, off to more useful pursuits now.

--Matt

P.S. I deleted the swear word, as this email bounced. (I can't send it to the list. ;)

At 02:38 AM 8/4/00, J-P wrote:
>In article <4 DOT 3 DOT 2 DOT 7 DOT 0 DOT 20000803161722 DOT 00aa8bf0 AT mail DOT subdimension DOT com>,
>Matt Lewandowsky  <djgpp AT delorie DOT com> wrote:
> >I was just pointing out that getting into the habit of using goto makes it
> >far too easy to short-circuit things that the programmer *was* clueful
> >enough to do.
>
>My point is that goto is an undeserving bete noire of programmers. If
>you're clueful enough to use malloc() instead of static arrays, use
>malloc() instead of static arrays. If you're clueful enough to use goto
>instead of making your code potentially tortuous to get yourself out of,
>say, an error, or a NULL-pointer return or some such, then use goto. If
>you're not clueful enough to do either, consider retiring to Visual Basic.
>
>Of course goto makes it more likely that you'll do something stupid. Using
>C makes it so much likely anyway, though, that the extra tiny margin isn't
>worth consigning a useful programming construct to the dumper for.
>
>This is going to turn into a holy war, isn't it? goto always gets this bad
>press, and whilst I always try and avoid its use, I don't mind using it if
>need be. You're the atheist, I'm the utilitarian :)
>
>Anyway, I'll put an "OFF TOPIC" up there so people can ignore it if they
>want. And I'll put a quick "swear word" in here - <SNIP> - to stop it from
>ending up in the mailboxes of people on the mailing list. I'm surprised
>goto *itself* isn't a swear word :)
>
>J-P

--===-=--==--==----=--=-=-----=====-----=-====--=-
Content-Type: application/pgp-signature

-----BEGIN PGP MESSAGE-----
Version: PGPfreeware 6.5.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBOYzLleoMko8dOmunEQJmeACfZM8jxtP03lImpXej0G0hKryAXnQAoMGN
i3NXuUvzZp3nX/PSZ3UrzBv8
=XlrM
-----END PGP MESSAGE-----

--===-=--==--==----=--=-=-----=====-----=-====--=---




- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019