🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #74

Re: smashing constants, sort of like Optimization by programmers

#74
From: John Levine
Date: Tue, 13 Oct 2026 00:35
31 lines
2605 bytes
According to Dan Cross <cross@spitfire.i.gajendra.net>:
>>> However, when a constant is passed to a function as an argument,
>>> clearly that constant should be treated as an *expression*, not as a
>>> variable. So you copy it to a temporary, and pass the address of the
>>> temporary to the function.
>>
>>And you think the language designers in 1956 could have figured that out ???
>
>I don't think that's the right framing.
>
>>>                           Not doing that was the bug.
>>
>>Some would disagree.
>
>That it's a bug?  Clearly, changing the value of some constant
>is surprising, at best.

I wasn't writing programs in 1958, having had a prior committment in
nursery school, but I was writing programs in the late 1960s.

I think you would find the attitude was yes, you could do that, but it
would be stupid, so don't. Remember that FORTRAN ran on a 70x with 32K
words of memory, S/360 subset FORTRAN E ran on a 360/30 with 32K bytes
and full FORTRAN G ran on a 360/40 with 128K bytes. Every word was
precious, and wasting three or four words creating a temporary to
defend against an obvious programmer error would have been silly.

-- 
Regards,
John Levine, johnl@taugh.com, Primary Perpetrator of "The Internet for Dummies",
Please consider the environment before reading this e-mail. https://jl.ly
Technical Details
Message-ID: <11ajubp$s9b$1@gal.iecc.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!weretis.net!feeder9.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!not-for-mail
References: <1177fdi$26ea4$1@dont-email.me> <6acd0635.21804140@news.eternal-september.org> <1791830400-5857@newsgrouper.org> <11ajic7$dq$1@reader2.panix.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!weretis.net!feeder9.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!not-for-mail
From: John Levine <johnl@taugh.com>
Newsgroups: comp.arch
Subject: Re: smashing constants, sort of like Optimization by programmers
Date: Tue, 13 Oct 2026 00:35:05 -0000 (UTC)
Organization: Taughannock Networks
Message-ID: <11ajubp$s9b$1@gal.iecc.com>
References: <1177fdi$26ea4$1@dont-email.me> <6acd0635.21804140@news.eternal-september.org> <1791830400-5857@newsgrouper.org> <11ajic7$dq$1@reader2.panix.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 13 Oct 2026 00:35:05 -0000 (UTC)
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970";
	logging-data="28971"; mail-complaints-to="abuse@iecc.com"
In-Reply-To: <1177fdi$26ea4$1@dont-email.me> <6acd0635.21804140@news.eternal-september.org> <1791830400-5857@newsgrouper.org> <11ajic7$dq$1@reader2.panix.com>
Cleverness: some
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: johnl@iecc.com (John Levine)