Turbo Pascal Version 3.00 [message #279037] |
Tue, 19 November 1985 13:59 |
smd
Messages: 10 Registered: May 2013
Karma: 0
|
Junior Member |
|
|
Article-I.D.: umcp-cs.2258
Posted: Tue Nov 19 13:59:59 1985
Date-Received: Thu, 21-Nov-85 04:11:15 EST
Distribution: net
Organization: U of Maryland, Computer Science Dept., College Park, MD
Lines: 56
Xref: watmath net.micro:12765 net.micro.cpm:4906 net.lang.pascal:379 net.micro.pc:5917
Replace this line with your compiler bug
I sat down to write the program for the next project I am going
to give to my Computer Science I class at home on my CPM system
with Turbo Pascal Version 3.00. The following program illustrates
the problem with the program I wrote:
program junk(input,output);
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;
begin
proca('I');
end.
The output using Turbo Pascal was:
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 A
While the output for the same program on a VAX with BSD UNIX,
IBM VM/SP CMS, or a Macintosh with MacPascal was:
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
as I expected. Calling Borland Technical Support was no help,
as they wanted a copy of the program on an IBM format disk.
The technical support specialist asked me to send a copy of the
program on a disk. When I asked "in what format?" she replied
"IBM, of course." I guess CPM does not exist anymore.
Obviously, I was quite surprised at the output, and now I
wonder how they tested the compiler. It seems that a program
as simple as the one above should have been tested.
-- Stanley Dunn
University of Maryland Department of Computer Science
|
|
|
Re: Turbo Pascal Version 3.00 [message #279044 is a reply to message #279037] |
Tue, 19 November 1985 22:43 |
Chris%ECLD
Messages: 6 Registered: September 2013
Karma: 0
|
Junior Member |
|
|
Article-I.D.: brl-tgr.3424
Posted: Tue Nov 19 22:43:04 1985
Date-Received: Thu, 21-Nov-85 22:15:10 EST
Sender: news@brl-tgr.ARPA
Lines: 6
There is a compiler option you need to turn on if you are going
to write recursive code (I forget what it is, you'll need to look
in the manual). This is because Turbo does not used stack-based
storage areas for data, and so must invoke special code to save
local data when a procedure is called recursively.
-------
|
|
|
Re: Turbo Pascal Version 3.00 [message #279045 is a reply to message #279037] |
Tue, 19 November 1985 23:26 |
|
Originally posted by: Cent.Mbeck%MIT-OZ@mit-mc.arpa (Mark Becker)
Article-I.D.: brl-tgr.3425
Posted: Tue Nov 19 23:26:54 1985
Date-Received: Fri, 22-Nov-85 23:51:44 EST
Sender: news@brl-tgr.ARPA
Lines: 15
Hello -
I took your example and passed it through CP/M-80 Turbo version
1.0 and find that, if I leave the recursion switch defaulted off
(i.e.; generate absolute code), I can reproduce your Turbo output.
If I turn the switch on, i.e.; permit generation of recursive
code, I get the same output you did from your other operating systems.
Question: did you have the recursive-code switch turned on?
Regards,
Mark Becker
Cent.Mbeck%Mit-OZ@Mit-MC
-------
|
|
|
Re: Turbo Pascal Version 3.00 [message #279049 is a reply to message #279037] |
Wed, 20 November 1985 22:44 |
|
Originally posted by: c55-hc@ucbbuddy.BERKELEY.EDU (Brent Chapman)
Article-I.D.: ucbvax.11043
Posted: Wed Nov 20 22:44:13 1985
Date-Received: Sat, 23-Nov-85 00:43:19 EST
References: <3424@brl-tgr.ARPA>
Sender: usenet@ucbvax.BERKELEY.EDU
Reply-To: c55-hc@ucbbuddy.UUCP (Brent Chapman)
Organization: University of California, Berkeley
Lines: 20
Xref: watmath net.micro:12776 net.lang.pascal:380
To compile a recursive program on a CPM-80 machine, you must set one
of the compiler switches. I BELIEVE (I don't have the manual sitting
in front of me) that the line that needs to be inserted is:
{$A-}
but I'm not absolutely certain; look it up in the back of the manual.
NOTE that this bug/switch applies ONLY to CPM-80 version of Turbo.
CPM-86 and MS-DOS do not need this switch, and may not even recognize
it.
Brent Chapman
ucbvax!ucbbugs!chapman chapman@bugs.berkeley.arpa
ucbvax!ucbamber!chapman chapman@amber.berkeley.arpa
ucbvax!ucbbuddy!c55-hc c55-hc@buddy.berkeley.arpa
Opinions expressed herein are strictly my own (but may be borrowed upon
request, for a suitable fee).
|
|
|
Re: Turbo Pascal Version 3.00 [message #279064 is a reply to message #279037] |
Thu, 21 November 1985 13:43 |
db21
Messages: 19 Registered: May 2013
Karma: 0
|
Junior Member |
|
|
Article-I.D.: ihuxk.1028
Posted: Thu Nov 21 13:43:46 1985
Date-Received: Sat, 23-Nov-85 05:06:09 EST
References: <2258@umcp-cs.UUCP>
Distribution: net
Organization: AT&T Bell Laboratories
Lines: 69
Xref: watmath net.micro:12790 net.micro.cpm:4915 net.lang.pascal:385 net.micro.pc:5953
> Replace this line with your compiler bug
>
> I sat down to write the program for the next project I am going
> to give to my Computer Science I class at home on my CPM system
> with Turbo Pascal Version 3.00. The following program illustrates
> the problem with the program I wrote:
>
> program junk(input,output);
> 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;
> begin
> proca('I');
> end.
>
> The output using Turbo Pascal was:
>
> 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 A
>
> While the output for the same program on a VAX with BSD UNIX,
> IBM VM/SP CMS, or a Macintosh with MacPascal was:
>
> 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
>
> as I expected. Calling Borland Technical Support was no help,
> as they wanted a copy of the program on an IBM format disk.
> The technical support specialist asked me to send a copy of the
> program on a disk. When I asked "in what format?" she replied
> "IBM, of course." I guess CPM does not exist anymore.
>
> Obviously, I was quite surprised at the output, and now I
> wonder how they tested the compiler. It seems that a program
> as simple as the one above should have been tested.
>
> -- Stanley Dunn
> University of Maryland Department of Computer Science
Because I happened to have a copy of my Turbo Pascal
compiler handy, I tried the above program in Turbo. When I ran
the program, I received the second set of outputs given in the
above article. The version of Turbo that I have is identified
as ver. 3.01A for the IBM. Apparently, Borland either corrected
this problem in the subsequent point (.01) release or there is
a significant difference between the CP/M and IBM versions of
Turbo. Hopes this helps in tracking down the problem.
For every problem there is one Dave Beyerl
solution which is simple, neat, ihuxk!db21
and wrong!
|
|
|
Re: Turbo Pascal Version 3.00 [message #279100 is a reply to message #279037] |
Fri, 22 November 1985 20:29 |
|
Originally posted by: johnson@noscvax.UUCP (Timothy A. Johnson)
Article-I.D.: noscvax.120
Posted: Fri Nov 22 20:29:31 1985
Date-Received: Mon, 25-Nov-85 07:23:55 EST
References: <2258@umcp-cs.UUCP>
Distribution: net
Organization: Naval Ocean Systems Center, San Diego
Lines: 65
Xref: watmath net.micro:12827 net.micro.cpm:4924 net.lang.pascal:394 net.micro.pc:5992
> Replace this line with your compiler bug
>
> I sat down to write the program for the next project I am going
> to give to my Computer Science I class at home on my CPM system
> with Turbo Pascal Version 3.00. The following program illustrates
> the problem with the program I wrote:
>
> program junk(input,output);
> 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;
> begin
> proca('I');
> end.
>
> The output using Turbo Pascal was:
>
> 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 A
>
> While the output for the same program on a VAX with BSD UNIX,
> IBM VM/SP CMS, or a Macintosh with MacPascal was:
>
> 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
>
> as I expected. Calling Borland Technical Support was no help,
> as they wanted a copy of the program on an IBM format disk.
> The technical support specialist asked me to send a copy of the
> program on a disk. When I asked "in what format?" she replied
> "IBM, of course." I guess CPM does not exist anymore.
>
> Obviously, I was quite surprised at the output, and now I
> wonder how they tested the compiler. It seems that a program
> as simple as the one above should have been tested.
>
> -- Stanley Dunn
> University of Maryland Department of Computer Science
Under the PC-DOS version of Turbo 3.0, the program runs correctly with
the same output as you have given for the other Pascals. The problem
may be associated with the CP/M-80 Compiler Directive "A". The default
is "A+" which inhibits recursive code. Switching to "A-" may solve your
problem. This is documented on or about page 318 in the 3.0 manual.
Timothy A. Johnson
Computer Sciences Corporation
|
|
|