🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #62

Re: Optimization by programmers

#62
From: MitchAlsup
Date: Mon, 12 Oct 2026 18:40
46 lines
2749 bytes
quadibloc@invalid.com (John Savard) posted:

> On Mon, 12 Oct 2026 11:25:32 -0000 (UTC), Thomas Koenig
> <tkoenig@netcologne.de> wrote:
> 
> >David Brown <david.brown@hesbynett.no> schrieb:
> >
> >> But if you receive a "pointer to const" parameter to a function, you can 
> >> still write via a cast version of the pointer if the original object was 
> >> not defined as "const".  (So objects defined as "const" may be placed in 
> >> read-only memory of some kind, and trying to change them might cause a 
> >> crash, signal, bus-error, etc.)
> >
> >In FORTRAN, it used to be possible on systems such as /360 to write
> >
> >      CALL FOO(21)
> >      WRITE (*,*) 21
> >      END
> >
> >      SUBROUTINE FOO(N)
> >      N = 42
> >      END
> >
> >and get a printout of 42 (21 is only half the truth,
> >remember!) because the compiler put the constants in read/write
> >storage and arguments were passed via address.
> 
> And the proper way to correct this error is obvious. Not by putting
> constants in a segment marked read-only. But in properly implementing
> language semantics.
> 
> So the values of constants are stored in memory.
> 
> 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 ???

>                           Not doing that was the bug.

Some would disagree.
> 
> John Savard
Technical Details
Message-ID: <1791830400-5857@newsgrouper.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!newsgrouper.org!.POSTED!not-for-mail
References: <1177fdi$26ea4$1@dont-email.me> <11a3ofn$2ak3s$1@dont-email.me> <11a5hd5$4qb$1@reader2.panix.com> <11a5lqo$2v5bq$1@dont-email.me> <11a6870$41j$1@reader2.panix.com> <11a6a6h$37i1n$1@dont-email.me> <1791742457-5857@newsgrouper.org> <11agm4p$2tfut$1@dont-email.me> <11ahs8q$38ir0$4@dont-email.me> <11aig3c$3hdcn$1@dont-email.me> <6acd0635.21804140@news.eternal-september.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!newsgrouper.org!.POSTED!not-for-mail
From: MitchAlsup <user5857@newsgrouper.org.invalid>
Newsgroups: comp.arch
Subject: Re: Optimization by programmers
References: <1177fdi$26ea4$1@dont-email.me> <11a3ofn$2ak3s$1@dont-email.me> <11a5hd5$4qb$1@reader2.panix.com> <11a5lqo$2v5bq$1@dont-email.me> <11a6870$41j$1@reader2.panix.com> <11a6a6h$37i1n$1@dont-email.me> <1791742457-5857@newsgrouper.org> <11agm4p$2tfut$1@dont-email.me> <11ahs8q$38ir0$4@dont-email.me> <11aig3c$3hdcn$1@dont-email.me> <6acd0635.21804140@news.eternal-september.org>
Date: Mon, 12 Oct 2026 18:40:00 GMT
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Message-ID: <1791830400-5857@newsgrouper.org>
Injection-Info: newsgrouper.org; mail-complaints-to="newsgrouper@yahoo.com"; posting-account=user5857
Injection-Date: Mon, 12 Oct 2026 18:40:00 GMT
User-Agent: Newsgrouper/0.9.0