Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83 based; site hou2h.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!hou2h!mr From: mr@hou2h.UUCP (M.RINDSBERG) Newsgroups: net.lang Subject: Re: Recursion Message-ID: <1045@hou2h.UUCP> Date: Thu, 12-Sep-85 11:46:59 EDT Article-I.D.: hou2h.1045 Posted: Thu Sep 12 11:46:59 1985 Date-Received: Fri, 13-Sep-85 04:22:40 EDT References: <250@mot.UUCP>, <4302@alice.UUCP> Organization: AT&T Bell Labs, Holmdel NJ Lines: 21 > >>> 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. > This doesnt really use up memory. Only during compilation. It may take time, though. Mark