TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Henk den Adel
from: Paul Edwards
date: 1997-03-18 08:01:30
subject: trap 0005

HdA> The same result (under OS/2 and DOS) could be achieved when static is 
HdA> omitted when simultaneously the stack size was enlarged to STACK:50000.

Sounds definitely like a stack problem.

HdA> I would appreciate if anyone could explain me why the stack is not 
HdA> automatically chosen to be sufficiently large, or better how to

If you ignore recursion, the maximum amount of stack size you can use is to
have every single function get called, in one big chain, in which case, the
stack size is the sum of all the local variables in all your functions.
Normally, this will be vast overkill.

If your source is in multiple files (hence multiple object code), you would
also need a method for the compiler to relay the info on stack requirements
to the object code.  I'm not sure whether the object format has that
ability.

Add recursion to this, and all chances of automatic determination are out the window.

Much easier to allow the user to specify the stack size!

HdA> order the compiler to choose the right stack size. I'm using ibm's C 
HdA> compiler, version 2.01.

Well, you go 

icc /B"/stack:50000" fred.c

BFN.  Paul.
@EOT:

---
* Origin: X (3:711/934.9)

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™.