Re: modifying constants in Fortran and elsewhere

Hans-Peter Diettrich <DrDiettrich1@netscape.net>
Sun, 16 Jul 2023 11:56:27 +0200

          From comp.compilers

Related articles
modifying constants in Fortran and elsewhere gah4@u.washington.edu (gah4) (2023-07-10)
Re: modifying constants in Fortran and elsewhere tkoenig@netcologne.de (Thomas Koenig) (2023-07-15)
Re: modifying constants in Fortran and elsewhere DrDiettrich1@netscape.net (Hans-Peter Diettrich) (2023-07-16)
Re: modifying constants in Fortran and elsewhere tkoenig@netcologne.de (Thomas Koenig) (2023-07-16)
Re: modifying constants in Fortran and elsewhere gah4@u.washington.edu (gah4) (2023-07-16)
Re: modifying constants in Fortran and elsewhere gah4@u.washington.edu (gah4) (2023-07-16)
Re: modifying constants in Fortran and elsewhere david.brown@hesbynett.no (David Brown) (2023-07-17)
Re: modifying constants in Fortran and elsewhere gah4@u.washington.edu (gah4) (2023-07-17)
| List of all articles for this month |

From: Hans-Peter Diettrich <DrDiettrich1@netscape.net>
Newsgroups: comp.compilers
Date: Sun, 16 Jul 2023 11:56:27 +0200
Organization: Compilers Central
References: 23-07-003 23-07-006
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="90854"; mail-complaints-to="abuse@iecc.com"
Keywords: code, history, comment
Posted-Date: 16 Jul 2023 12:01:13 EDT
In-Reply-To: 23-07-006

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]


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.