Path: utzoo!attcan!uunet!husc6!mailrus!cornell!rochester!ken From: ken@cs.rochester.edu (Ken Yap) Newsgroups: comp.os.cpm Subject: Re: COMPAS/Turbo/recursion program Message-ID: <11055@sol.ARPA> Date: 3 Jul 88 04:38:13 GMT References: <8807021208.AA10306@caliph.dec.com> Reply-To: ken@cs.rochester.edu (Ken Yap) Organization: U of Rochester, CS Dept, Rochester, NY Lines: 19 |The program as originally submitted will not work in *any* correctly |implemented Pascal, because it allows only one byte for the variable |"nextchar". Declaring the variable inside a procedure doesn't mean |that the variable will have a new space created for it on every call |to the procedure; it only means that the variable is not global. I beg your pardon? Distinct instances of called procedures should have their own instances of local variables, otherwise recursion is handicapped. Any Pascal compiler that doesn't implement this correctly is brain-damaged. (I know there are some micro compilers out there that require recursive procedures to be identified as such, so that they can get away with allocating static storage for local variables instead of stack storage, because stack manipulation is expensive on itty-bitty micros.) The relevant reference is J&W 3rd edition, paragraph 10.3. The reason why the program posted won't work as such is because of line buffering on most systems. Ken