C vs. FORTRAN
T. William Wells
bill at proxftl.UUCP
Thu Jul 14 08:29:05 AEST 1988
In article <773 at naucse.UUCP>, rrr at naucse.UUCP (Bob Rose ) writes:
) In article <5234 at ihlpf.ATT.COM>, nevin1 at ihlpf.ATT.COM (00704a-Liber) writes:
) > Security in FORTRAN (with respect to calling conventions)?? Look at the
) >
) > 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.
)
)
) Oh boy! You must be using some sort of new compiler. The old one's (not
) all of course) would after running this code change _all_ integer constants
) of value 1 to value 5. Try debugging the code after that occurs.
) -bob
Back in the days of punch cards, I once substituted a `1' for an
`I' in a subroutine call. This was not that hard to do given
that they were just a shift away. And the printer on the
keypunch wasn't that good; one could examine the print all day
and not tell the difference. Of course the program acted really
strange when the function modified that argument.
Anyway, I spent THREE DAYS finding this. I finally found it by
assuming that it was a compiler bug and doing the usual
cut-out-code stuff. Of course, it wasn't a compiler bug, just a
typo. Arg...
Eighteen years later, I still remember. Anyway, it's things
like that that have given, at least to me, call-by-reference as
the default a bad odor.
More information about the Comp.lang.c
mailing list