TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: All
from: Henk den Adel
date: 1997-03-16 22:52:52
subject: trap 0005

Hi All,

I'm trying to write functions (library) for reading data and its description.

- When compiled under DOS (Turbo C) the result is unpredictable, so
  "something rotten is in the state of my code".
- Under OS/2 the program traps 0005 before anything is done, even the
  first executable statement is not executed. (PM debugger).
- Under Unix everything runs perfectly well.

As i am puzzled by this anomaly, i tried some more compilers. MS C tells me
that 'automatic data allocation exceeds 32k'. The reason for this message
is a struct, which is 40 kB in size.

When i changed:

   struct desc heads;

into:

   static struct desc heads;

problems are solved under OS/2 and DOS; the reason probably is that the
struct is placed in the data segment.

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

I would appreciate if anyone could explain me why the stack is not
automatically chosen to be sufficiently large, or better how to
order the compiler to choose the right stack size. I'm using ibm's C
compiler, version 2.01.


Groeten,
 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 160 711/401 413 430 934 712/311
SEEN-BY: 712/407 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™.