www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/24/12:24:40

From: "A.Appleyard" <A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk>
Organization: Materials Science Centre
To: DJGPP AT DELORIE DOT COM
Date: Fri, 24 May 1996 16:59:53 GMT
Subject: how many function calls deep am I?
Message-ID: <F503444EAC@fs2.mt.umist.ac.uk>

int depth(){long j,i;for(i=long(&i+2),j=0;i;i=*((long*)i),j++);return j;}

I wrote this short function. In djgpp (at least in version 1) it gives how
many stack call levels deep you are, so that e.g. you can easily indent trace
output with depth() number of spaces or `#''s at the start of each line, to
keep track of function entries and exits somewhat.

- Raw text -


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