Next: , Previous: -mstackcheck, Up: Invocation


2.8 -mstackextend

-mstackextend’ is very similar to ‘-mstackcheck’ (see -mstackcheck).

The main difference is that when a program runs out of stack, it is not aborted, but a new stack area is allocated and the program continues to run.

Note: Stack extension can slow programs down significantly. It is advised that programs are written in such a way that they do not require too much stack. This can generally be achieved by explicitly allocating memory for large structures and arrays using functions like ‘malloc()’ or ‘AllocMem()’, instead of creating them as local variables. Another method is replacing recursion with iteration. In addition, it might be considered to use stack extension only for selected, “dangerous” functions (see stackext), not for all functions in a given program.

The negative form of ‘-mstackextend’ is ‘-mno-stackextend’, and is on by default.

Warning: ‘-mno-stackextend’ used to be called ‘-mnostackextend’ before ‘Geek Gadgets’ snapshot ‘961012’.

For more information, please refer to the ‘LibNIX’ documentation.