<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Wed, 20 Nov 1985 07:47:40 PST
From   : crash!ihom@SDCSVAX.ARPA
Subject: Re: Turbo Pascal Version 3.00

Stanley, the problem is that you're not using Turbo's 'Absolute Code'
directive {$A+-}.  It's default is absolute code {$A+}. Since your
test program is recursive (proca calls procb calls proca), you'll have
to disable absolute code to allow recursive calls {$A-}.  Recursion in
CP/M executes slower and takes up more memory.  The correction outputs
as expected.

program junk;
{$A- recursion}
   procedure proca(chita:char); forward;
   procedure procb(chitb:char);
      begin
         writeln('Entering procb with a ',chitb);
         proca('A');
         writeln('Leaving procb with a ',chitb);
      end;
   procedure proca;
      begin
         writeln('Entering proca with a ',chita);
         if chita = 'I' then procb('I');
         writeln('Leaving proca with a ',chita);
      end;
{$A+ absolute}
begin
   proca('I');
end.

Outputs...

Entering proca with a I
Entering procb with a I
Entering proca with a A
Leaving proca with a A
Leaving procb with a I
Leaving proca with a I


--Irwin Hom     ...crash!ihom@ucsd
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>