TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Henk den Adel
from: Mike Phillips
date: 1997-03-30 22:15:18
subject: Re: trap 0005

-28 Mar 97  04:59:25-

=Henk den Adel babbled to Mike Phillips about trap 0005=



 MP> What if the other function needs 45k?



 HdA> Allocate 40+45 kB of stacksize.



But the compiler does not and cannot know that the other function needs

45k since that function is in another source file.  All it knows is

that your function needs 40k. 



 MP> What if the other function calls yet another function?

 JH> What if your function calls another-one and that one again calls another

 JH> one..?



 HdA> add another X kB.



Even if X is an unknown?



 JH> So the maximum needed size for the stack strongly depends on program-flow

 JH> and can only be determined at runtime.



 HdA> What you means to say is: there is no general solution of the

 HdA> sufficiently large dimensioned stack size, no solution will be

 HdA> provided, even non for the most simple cases. 

 MP> Since the compiler does not follow the logic of your code, it cannot know

 MP> how large to make the total stack segment.



 HdA> Do you mean: due to possible recursion?



You're halfway there.  There is also the case of a function calling

another that calls yet another, etc.  The compiler would have to follow

the logic to catch that.  If you have Borland C++ or EMX, check out the

RTL code.  Look at all those functions calling other functions.



Mike Phillips

INTERNET:  phil4086{at}utdallas.edu



... MAC        Masquerading As a Computer

--- FMail/2 1.22
* Origin: oOo The Pit Viper oOo (1:124/2145)
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: 124/2145 2342 1 396/1 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™.