www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/07/19/10:08:26

From: Martin Str|mberg <ams AT speedy DOT ludd DOT luth DOT se>
Subject: Re: Recursions and Static declarations....?Is this wrong...
Newsgroups: comp.os.msdos.djgpp,comp.lang.c
References: <5a91d0ef DOT 0207181004 DOT 49e67056 AT posting DOT google DOT com> <ah8k0q$lqv$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> <1027079317 DOT 518196 AT queeg DOT ludd DOT luth DOT se> <ah91c3$5es$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE>
User-Agent: tin/1.4.4-20000803 ("Vet for the Insane") (UNIX) (NetBSD/1.5_BETA (alpha))
Message-ID: <1027083579.642014@queeg.ludd.luth.se>
Cache-Post-Path: queeg.ludd.luth.se!unknown AT speedy DOT ludd DOT luth DOT se
X-Cache: nntpcache 2.4.0b5 (see http://www.nntpcache.org/)
Date: 19 Jul 2002 12:59:39 GMT
Lines: 24
NNTP-Posting-Date: 19 Jul 2002 12:59:39 GMT
NNTP-Posting-Host: queeg.ludd.luth.se
X-Trace: 1027083579 news.luth.se 468 130.240.16.109
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

In comp.os.msdos.djgpp Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de> wrote:
: Yes. I'll admit I was quite uncorrect in my original answer.  But
: then, so would the much simpler

:> void f(int i)
:> {
:>   if(0 < i)
:>     f(i-1);
:>   printf("f: depth = %d.\n", i + 1);
:> }

: Counting recursions levels like in your example does work, but it can
: be pretty pointless doing so if the recursion is controlled by an
: integer parameter like in this example.

Yes. But the point I'm reaching is that even if the original program
didn't do what the programmer thought, it certainly shouldn't
crash because of any static declared variables being used in a
recursive function. The crash must be because of something else.


Right,

						MartinS

- Raw text -


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