Microsoft open sources GWBASIC
Norman Jaffe
turing at shaw.ca
Tue Jun 2 06:46:46 CDT 2020
Yes, and on some machines, like the IBM 1800, small numeric constants are stored in a common location, to reduce the size of executable images.
So, once you've changed 4 to 5, it means that all programs that get loaded will now use 5 when they meant 4.
Usually the generated code has a way to refer to zero without using the common constant area, but not numbers like 1 or 2, so setting 1 or 2 to zero will have 'interesting' effects.
Especially if the machine is controlling heavy equipment.
[I bear witness to the result - been there, did that...]
From: "cctalk" <cctalk at classiccmp.org>
To: "cctalk" <cctalk at classiccmp.org>
Sent: Monday, June 1, 2020 11:40:10 PM
Subject: Re: Microsoft open sources GWBASIC
On Mon, 1 Jun 2020 at 00:14, Eric Korpela via cctalk
<cctalk at classiccmp.org> wrote:
> C
> C CHANGE THE VALUE OF 4
> C
>
> CALL INC(4)
> WRITE (*, 30) 4
> 30 FORMAT ('2+2=',I4)
> END
>
> SUBROUTINE INC(I)
> I = I + 1
> END
>
> -------- OUTPUT
> 2+2= 5
I had no idea, and I wrote a lot of FORTRAN for a few years. I just
tested the above with the Fortran-77 compiler for my ND-100 mini, and
yes, it prints 2+2= 5
More information about the cctalk
mailing list