From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,c9d5fc258548b22a X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: How do I write directly to a memory address? Date: Mon, 7 Feb 2011 15:54:18 -0600 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <67063a5b-f588-45ea-bf22-ca4ba0196ee6@l11g2000yqb.googlegroups.com> <31c357bd-c8dc-4583-a454-86d9c579e5f4@m13g2000yqb.googlegroups.com> <05a3673e-fb97-449c-94ed-1139eb085c32@x1g2000yqb.googlegroups.com> <8r86vgFc3uU1@mid.individual.net> <19fh1chm74f9.11cws0j5bckze.dlg@40tude.net> <5d9bd120-4953-4fb1-a890-27267245e954@8g2000prt.googlegroups.com> <883b7161-15ee-4874-95bb-2e0273dab51d@y36g2000pra.googlegroups.com> <8r9iboFkfvU1@mid.individual.net> <14246472-9488-488a-8720-77b85b91707c@d23g2000prj.googlegroups.com> <8r9ouqFselU1@mid.individual.net> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1297115660 26757 69.95.181.76 (7 Feb 2011 21:54:20 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Mon, 7 Feb 2011 21:54:20 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5931 Path: g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!feed.ac-versailles.fr!news.ecp.fr!news.jacob-sparre.dk!pnx.dk!not-for-mail Xref: g2news1.google.com comp.lang.ada:16949 Date: 2011-02-07T15:54:18-06:00 List-Id: "Simon Clubley" wrote in message news:iiopbr$bs7$1@news.eternal-september.org... ... > I realised after posting, this was open to confusion by people who had not > encountered this before so a more detailed example follows. The word > constant > above does not refer to a programmer defined constant, but a compiler > defined > constant. You mean a numeric literal (to use the Ada terms). > In the statement: > > c = (4 * i) + 2 > > the compiler would allocate memory locations containing the values 4 and > 2. > These memory locations would then be used in the generated code whenever > the > values of 2 or 4 were found. In other words, all access, including > literals, > was by reference. > > This was a long time ago however. Must have been. I remember hearing this story in college. And it supposely was old then. I've always thought of it as a sort of urban legend. But I suspect that it has more to do with the instruction set of the target machine. On the Intel architectures that I've worked on my entire working life, it wouldn't make sense to have a global memory location holding a literal (the literals can be folded into instructions at very little cost). But I can imagine cases where that wouldn't be true. Randy.