delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/08/04/06:45:48

From: eglebbk AT dds DOT nl (Evert Glebbeek)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: BREAKing out of a nested loop
Date: Fri, 04 Aug 2000 10:42:51 GMT
Organization: Physics student, University of Amsterdam
Lines: 35
Distribution: world
Message-ID: <398a9632.4401298@news.wins.uva.nl>
References: <005a01bffd43$030a3520$0500007b AT brk> <3989d7e4_1 AT news DOT uni-bielefeld DOT de> <3989f2c4 DOT 3822910 AT news DOT wins DOT uva DOT nl> <398a784a$1_1 AT news DOT uni-bielefeld DOT de>
NNTP-Posting-Host: stol-117-166.uva.studentennet.nl
X-Trace: info.wins.uva.nl 965385643 29201 145.98.117.166 (4 Aug 2000 10:40:43 GMT)
X-Complaints-To: usenet AT science DOT uva DOT nl
NNTP-Posting-Date: Fri, 4 Aug 2000 10:40:43 +0000 (UTC)
X-Newsreader: Forte Free Agent 1.11/32.235
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Newsgroup: comp.os.msdos.djgpp
 From: manni DOT heumann AT gmx DOT de (Manni Heumann)
 On Fri, 04 Aug 2000 08:01:13 GMT

>>if (sprites_collide(sprite1, sprite2))
>>  do_mega_big_explosion();
>>
>
>
>Ok, I can see that. But what you have here is an example of 
>how easy programming can be if you use exceptionally good 
>libraries like Allegro. All you have to supply to that 
>function are two tiny arguments, that already contain all 
>the information you will need in that function. But often 
>you will find yourself passing endless arguments back and 
>forth.
Allegro doesn't know about sprites or collison detection, it knows
about bitmaps. My snipped of code assumes *you* made a function to
check for collision detection and created a sprite structure.
My point is that in writing your code, you should try to make it so
that things like this are possible. This can be easily done by using a
struct for storing all the sprite data.

>Can we settle on this: Generally discouraging the use of 
>goto would be going to far, just like demanding a goto in 
>each and every case of breaking out of a nested loop.
Partially; It is my opinion that you should always try to look for
alternatives to goto, because it is my experience that they make your
program more readable and easier to maintain later on. Still, if there
are no other solutions, use it. I think my advise would be: try other
things first, use goto with care.

Regards,

Evert Glebbeek.

- Raw text -


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