delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/08/16/04:28:09

To: DJGPP AT SUN DOT SOE DOT CLARKSON DOT EDU
From: A DOT APPLEYARD AT fs1 DOT mt DOT umist DOT ac DOT uk
Date: 16 Aug 93 09:23:16 GMT
Subject: How to find many stack nesting levels I am

/*-----*//* in Gnu C++, returns how many function incarnations in stack */
int depth() {long j,i; for(i=long(&i+2),j=0;i;i=*((long*)i),j++); return j;}
/*-----*//* in Gnu C++, prints depth() spaces on file F */
void In(FILE*F) {int i=depth(),j; for(j=1;j<i;j++) putc(' ',F);}
/*-----*/
  I have go32 version 1.08, gcc version 2.2.2, gas version 1.38.1, bison
version 1.16, flex version 2.3.7 . If I call 'In(debug_output_file);' at the
start of each line of trace output, the trace output is thereby indented
according to how many function calls deep the program is then. This is useful
in debugging programs that have a lot of functions or recursion.

  ............................................

  P.S. What is the latest release of each part of djgpp? Briefly what bugs are
known in the latest release?, or where can I get a list of those bugs? When
will the next release be out? please.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019