Path: csiph.com!weretis.net!feeder6.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: Hans-Peter Diettrich Newsgroups: comp.compilers Subject: Re: modifying constants in Fortran and elsewhere Date: Sun, 16 Jul 2023 11:56:27 +0200 Organization: Compilers Central Sender: johnl%iecc.com Approved: comp.compilers@iecc.com Message-ID: <23-07-007@comp.compilers> References: <23-07-003@comp.compilers> <23-07-006@comp.compilers> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" 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 X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com In-Reply-To: <23-07-006@comp.compilers> Xref: csiph.com comp.compilers:3503 On 7/15/23 12:57 PM, Thomas Koenig wrote: > gah4 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 >> 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]