Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ Language Reference - _chkstack http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
   _chkstack

   Usage
   #include <stdef.h>
   size_t _chkstack(void);

   Description
   _chkstack  determines  if the stack has grown larger than  the  memory
   allocated  for it and if so, aborts the program with a stack  overflow
   message.  This  function should be called in  recursive  functions  or
   other  functions that might use a lot of stack  space.  Alternatively,
   stack   checking  can  be  inserted  in  the  code  automatically   at
   compilation  both  from  within the environment and by  using  the  -s
   switch in the ZTC command line.

   Example
   /* do_tree is a recursive func */

   do_tree(t)
   struct tree *t;
   {
   #ifdef __ZTC__/* defined if Zortech C / C++ */
   _chkstack();
   #endif

   /* ...more code...  */

        do_tree(t->left);
        do_tree(t->right);
   }

   Return Value
   Returns  the number of bytes left on the stack, if the stack  has  not
   overflowed.


Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson