Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site alice.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!alice!ark From: ark@alice.UucP (Andrew Koenig) Newsgroups: net.lang Subject: Re: Recursion Message-ID: <4302@alice.UUCP> Date: Wed, 11-Sep-85 16:15:16 EDT Article-I.D.: alice.4302 Posted: Wed Sep 11 16:15:16 1985 Date-Received: Thu, 12-Sep-85 11:50:43 EDT References: <250@mot.UUCP> Organization: Bell Labs, Murray Hill Lines: 13 >> I think that would be a good idea, but wouldnt it be limited to direct >> recursion ( i.e. routine A calls A as apposed to A calls B, B calls A ). I >> don't know PL/I, but I would think including such a check for anything other >> than direct recursion would be a royal pain for a compiler writter. >> > Actually, it's not too bad. You just set up an n-by-n Boolean matrix > where n is the number of subroutines under consideration and the > ij element is 1 iff routine i calls routine j. Then take the > transitive closure by Warshall's algorithm. 1's on the diagonal of > the result indicate which routines are indirectly recursive. This uses up memory proportional to the square of the number of subroutines. Not a good idea.