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)
|