_stklen
Holds size of the stack.
Defined in header <dos.h>
Syntax
extern unsigned _stklen;
Remarks
_stklen specifies the size of the stack for all six memory models. The
| minimum | stack size allowed is 128 words; if you give a smaller value, |
_stklen is automatically adjusted to the minimum. The default stack size is 4K.
In the small and medium models, the data segment size is computed as follows:
data segment [small,medium] = global data + heap + stack
where the size of the heap can be adjusted with Jieaplen.
In the tiny model, everything (including code) is in the same segment, so the data segment computations are adjusted to include the code plus 256 bytes for the program segment prefix (PSP).
data segment [tiny] = 256 + code + global data + lieap + staclc In the compact and large models, there is no near heap, and the stack is in its own segment, so the data segment is simply
data segment [compact,large] =" global data
In the huge model, the stack is a separate segment, and each module has its own data segment.
See also
Jieaplen
Example
#include <stdio.]i>
/* Set tlie stacJc size to be greater tliantliedefault. */
/* This declaration must go in the global data area. */
extern unsigned _st}:len = 54321U;
/* show the current stack length */
printfC'The stack length is: %u\n", _stklen);
return 0;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Extraction notes
- heading `stklen` read as `_stklen`
Stable link: /3.1/dos.h/_stklen/
· short form /3.1/_stklen/