C vs. FORTRAN

Barnacle Wes wes at obie.UUCP
Sun Jul 10 04:41:13 AEST 1988


In article <5234 at ihlpf.ATT.COM>, nevin1 at ihlpf.ATT.COM (00704a-Liber) writes:
> 	subroutine foo(j)
> 	j = 5
> 	end
> 	...
> 	call foo(1)
> 
> This passes through the compiler with no problem.  If you look at the
> run-time error, it's usually a memory violation and not a
> compiler-generated error.  Some security.

On the IBM 360 Fortran IV compiler, this would have the nasty effect of
making all future references to 1 come out 5.  The 360 instruction set
did not have any operations with immediate operands, so the Fortran
compiler would create a data area with "Define Constant" declarations
for each and every constant in the program.  If you choose to put
another value in your constants, that was your problem, not the
compilers, or the computers.  Like the old adage:

  "Constants aren't and variables won't."
-- 
                     {hpda, uwmcsd1}!sp7040!obie!wes
           "Happiness lies in being priviledged to work hard for
           long hours in doing whatever you think is worth doing."
                         -- Robert A. Heinlein --



More information about the Comp.lang.c mailing list