<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Sun, 03 Jul 1988 04:38:13 GMT
From   : rochester!ken@cu-arpa.cs.cornell.edu (Ken Yap)
Subject: COMPAS/Turbo/recursion program

|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

<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>