www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/11/15/16:00:41.1

Message-Id: <199811152033.UAA07025@remus.clara.net>
From: "Arthur" <arfa AT clara DOT net>
To: <djgpp AT delorie DOT com>
Subject: RE: Will there be an out of memory error?
Date: Sun, 15 Nov 1998 20:32:44 -0000
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0
In-Reply-To: <01be106c$56dd2b00$LocalHost@a>
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Importance: Normal
Reply-To: djgpp AT delorie DOT com

> Consider these two method.
>
> (I)method number one
> --------------------
> int check_spaceship_collide();
> int main(){
> 	...
> 	if (check_spaceship_collide()==1) then life--;
> 	...
> 	}
>
> (II)method number two
> ---------------------
> int check_spaceship_collide_return;
> void check_spaceshit_collide();
             ^^^^^^^^^
Was this Freudian? I know that programming can be stressful at times... :-)

> int main(){
> 	...
> 	check_space_ship_collide();
> 	if (check_spaceship_collide_return==1) then life--;
> 	...
> 	}
>
> I prefer method number one but I've programmed a floodfill program in
> MS-Qbasic and I found that if I use method number one, then I get
> an out of
> memory error, but method number two does not return an out of
> memory error.
> So I want to know whether djgpp also return an out of memory error for
> method number one.

Method number one would be the preferred method in C. I have no idea why
QBasic would return out of memory - not unless it's with some other part of
your code.   All I can suggest is that there's something in your floodfill
code that absorbs all available memory.

OK, so both methods _should_ work in C, but using the first method is better
structure.

James Arthur
jaa AT arfa DOT clara DOT net
ICQ#15054819


- Raw text -


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