Kibbitz, example (Re: reentrant...)

Blair P. Houghton bph at buengc.BU.EDU
Tue Aug 2 10:09:24 AEST 1988


In article <4790 at pasteur.Berkeley.EDU> anton at postgres.UUCP (Jeff Anton) writes:
>
>You could, for example, have a static variable in a recursive
>routine so long as you no longer use that variable after you make the
>recursive call, or only use it after the last recursive call.

As always, the exceptions pop up when murky definitions begin to bleed.

I once used exactly the opposite of Jeff's caveat when I tried to
figure the relative amount of time some routines were taking in
relation to the main routine; I set a unique external variable in
each, incremented at each call (including the recursive ones, very
handy for counting the recursion depth), and timed the running
of the program using 'time'.  It was, of course, not the most
accurate way to do it, since the routines weren't all long enough
to make the time taken by the increment negligible, but it was fun
and better than guessing, and I did make the program run faster
by using it and optimizing the most-called routines.

				--Blair



More information about the Comp.unix.wizards mailing list