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 Path: g2news1.google.com!news3.google.com!feeder.news-service.com!85.214.198.2.MISMATCH!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Simon Clubley Newsgroups: comp.lang.ada Subject: Re: How do I write directly to a memory address? Date: Tue, 8 Feb 2011 12:46:41 +0000 (UTC) Organization: A noiseless patient Spider 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> Injection-Date: Tue, 8 Feb 2011 12:46:41 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="4pjzwDT2MPp9AkNxUo/C4Q"; logging-data="30246"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+LCtWSMXKvrNcfazti2jNqx2/CZF+XVl4=" User-Agent: slrn/0.9.8.1 (VMS/Multinet) Cancel-Lock: sha1:N3T6XDC1X/iDRZ16jLt1yIkclwU= Xref: g2news1.google.com comp.lang.ada:16986 Date: 2011-02-08T12:46:41+00:00 List-Id: On 2011-02-07, Randy Brukardt wrote: > "Simon Clubley" wrote in > message news:iiopbr$bs7$1@news.eternal-september.org... > > You mean a numeric literal (to use the Ada terms). > Yes. I was in too much of a rush when I wrote the original posting. >> 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. > As someone else has commented in another posting, something like this also happened to them, but I can see how it might be considered a urban legend if you have only used more mainstream hardware. In my case, this was during the 1980's while I was still in the sixth form (the US equivalent of the sixth form would be high school) and was taking advanced (for the time :-)) programming classes at the local higher education establishment as part of my sixth form education. The miniframe which was installed there was a obscure miniframe from Sperry/Unisys and not something mainstream like a PDP-11. The operating system and compilers were quite limited even by the standards of what was available in those days and given these other limitations, this global sharing and allowed overwriting of literals by the generated compiler code is not a surprise in hindsight. Simon. -- Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP Microsoft: Bringing you 1980s technology to a 21st century world