delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/08/04/04:30:24

Newsgroups: comp.os.msdos.djgpp
From: manni DOT heumann AT gmx DOT de (Manni Heumann)
Subject: Re: BREAKing out of a nested loop
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>
X-Newsreader: News Xpress 2.01
Mime-Version: 1.0
Date: Fri, 04 Aug 2000 07:52:29 GMT
NNTP-Posting-Host: dhcp33-228.uni-bielefeld.de
Message-ID: <398a763d$1_1@news.uni-bielefeld.de>
X-Trace: 4 Aug 2000 09:52:29 +0200, dhcp33-228.uni-bielefeld.de
Lines: 39
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

djgpp AT delorie DOT com wrote:

>One good reason to keep in mind: you may get into the habit of using it. 
>And in C, it's a worse habit than BASIC. Let's say that you have an 
>oft-used loop whose nesting make this one look simple. Let's say you want 
>to break out of it simply. Lets say that you forgot there's a free() five 
>levels out after this point.  You use goto. See a potential problem?
>
>Wow. I've been reading too many "War On Drugs" propaganda items today, 
>haven't I? Anyway, I *think* it's somewhat coherent...

I got you, don't worry.
But it's not very hard to take your point one little step 
further: Don't break out of loops at all.

Sure, goto can be dangerous. But thinking about it: Name 
just one element of the C-language that can not be 
dangerous. Just one single element that let's you not do 
something stupid.

The most harmless little thing I could think of is the 
semicolon. But I often did stupid things with that. I guess 
we all did: 
if (something);

What else seems innocent? How about printf?
printf ("manni is a jerk");
Now that was stupid.
printf ("%d manni is a jerk %d");
Stupid and dangerous.

Ok, I'm blabbering, I know.


--

Manni

"Life would be much easier if I had the source code."

- Raw text -


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