Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #3503

Re: modifying constants in Fortran and elsewhere

From Hans-Peter Diettrich <DrDiettrich1@netscape.net>
Newsgroups comp.compilers
Subject Re: modifying constants in Fortran and elsewhere
Date 2023-07-16 11:56 +0200
Organization Compilers Central
Message-ID <23-07-007@comp.compilers> (permalink)
References <23-07-003@comp.compilers> <23-07-006@comp.compilers>

Show all headers | View raw


On 7/15/23 12:57 PM, Thomas Koenig wrote:
> gah4 <gah4@u.washington.edu> schrieb:
>> A potential bug since the earliest days of Fortran is passing a
>> constant to a subroutine, and then changing the value of the dummy
>> argument.

> I actually got bitten by that while using a mainframe for scientific
> work as a student.  It's been a few decades, so I don't recall too
> many details.  It was difficult to find, but I was paid by the hour,
> so I didn't mind too much :-)

I remember such a bug in the 80s on the pdp-11/34 of our institute.


> Algol 60 tried to define
> its argument passing in an elegant way, and accidentally invented call
> by name when they meant call by reference. -John]

By Name example from the German wikipedia
<https://de.wikipedia.org/wiki/Namensparameter>

 >>
A[1] := 10
A[2] := 20
i := 1
x := Funkt (A[i], i)

FUNCTION Funkt (a, i) : Real
   i := i+1
   RETURN a
END

x wird der Wert 20 zugewiesen. Im Werteparameter-Fall wäre x dagegen 10,
ebenso bei Referenzparametern.
<<
Returns 20 as ByName while 10 were returned for ByRef.

DoDi
[Then there's the infamous Knuth Man or Boy program, where even he
couldn't figure out what the answer was supposed to be.
https://en.wikipedia.org/wiki/Man_or_boy_test
-John]

Back to comp.compilers | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

modifying constants in Fortran and elsewhere gah4 <gah4@u.washington.edu> - 2023-07-10 19:42 -0700
  Re: modifying constants in Fortran and elsewhere Thomas Koenig <tkoenig@netcologne.de> - 2023-07-15 10:57 +0000
    Re: modifying constants in Fortran and elsewhere Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2023-07-16 11:56 +0200
    Re: modifying constants in Fortran and elsewhere Thomas Koenig <tkoenig@netcologne.de> - 2023-07-16 13:08 +0000
      Re: modifying constants in Fortran and elsewhere gah4 <gah4@u.washington.edu> - 2023-07-16 19:09 -0700
        Re: modifying constants in Fortran and elsewhere gah4 <gah4@u.washington.edu> - 2023-07-17 10:51 -0700
      Re: modifying constants in Fortran and elsewhere gah4 <gah4@u.washington.edu> - 2023-07-16 19:17 -0700
  Re: modifying constants in Fortran and elsewhere David Brown <david.brown@hesbynett.no> - 2023-07-17 13:09 +0200

csiph-web