<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Tue, 05 Jul 1988 16:31:54 EDT
From   : "Erik L. Seielstad" <ERIK%BROCK1P.BITNET@CICGE.RPI.EDU>
Subject: TRYIT pascal example...again.

In a recent issue of the cpm digest, I saw the following:
>Recursion program discussed earlier in INFO-CPM Digest - implemented
>for Turbo Pascal.
>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 am forced to disagree.  The definition of Pascal sets up a
stack frame at runtime for each invocation of a subroutine.  This is
the reason ANY recursion is possible in pascal.  The program TRYIT
was a simple example of recursion, and *should* work on all pascal
compilers.  I tried it here on our mainframe, and it worked fine as
written.
    The reasson it does not work on Turbo Pascal, is Borland
allocates static storage for all variables at compile time, unless
the special compiler directive {A+} is used.
    -Erik @ Brock1p
/* the views expressed are brought to you as a public service */
/* by me. (and nobody else but me) */

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