pop@cs.umass.edu ( Robin Popplestone ) writes:
>I seem to recall hearing that early versions of Fortran would accept
>statements like
>
> 3 = 4
>
>and interpret them as specifying that the constant "3" should have the
>value "4" from now on.
Actually what I had heard was that some older compilers would let you pass
constants into a routine in the place of a variable that was passed by
address.
It did this because all numeric constants were stored in fixed memory locations
and then referenced by address rather than value...
Anyway, If the called procedure then changed the variable, it would change
the global place where that constant was stored, rendering 3=4 for the rest of
the program...
(In Pascal :: my Pop is too rusty...
the following program would output the number 5
)
program(input,output);
procedure callfoo;
var a : integer;
begin
foo(3);
a := 1;
writeln(a+3);
end;
procedure foo (var bob:integer);
begin
bob := 4 ;
end;
begin
callfoo;
end.
David (whitten@fwva.saic.com) US:(619)535-7764 [I don't speak as a company rep.]
|