TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Mario Semo
from: Henk den Adel
date: 1997-03-27 21:20:26
subject: trap 0005

Tag Mario,

you wrote me:

[Automatic stack size]

 MS> void stackEater(int x)
 MS> {
 MS>  if (x==0) return;

 MS>  char c[1000];
 MS>  x--;
 MS>  stackEater(x);
 MS> }

Smells recursive. I agree on your point. Without recursion however, i'm not
convinced yet. Maybe swap line if (x==0) return; and char c[1000];?

 MS> how much stack does this program need?

atoi(argv[1])*1000 bytes, maybe 1000 more or less. I see your point, the
amount of stack can not be determined in advance, due to the recursive
nature of the program.


Mit freundlichen Gruessen,
 Henk

--- GoldED 2.50+
* Origin: Henks Toolbox (00-06h), Mail only (2:286/415)
SEEN-BY: 50/99 54/99 270/101 620/243 625/155 711/401 413 430 934 712/311 407
SEEN-BY: 712/505 506 517 623 624 704 713/317 800/1
@PATH: 286/415 4 700 280/801 270/101 712/624 711/934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.