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: 103376,c9d5fc258548b22a X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.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: Mon, 7 Feb 2011 12:42:35 +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: Mon, 7 Feb 2011 12:42:35 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="4pjzwDT2MPp9AkNxUo/C4Q"; logging-data="12167"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19YLfrpyGn7EMGJbB6tj3sS9KcPU1N+mL0=" User-Agent: slrn/0.9.8.1 (VMS/Multinet) Cancel-Lock: sha1:9GEmwrU6PNoayGEWzkWnGD6yQV0= Xref: g2news1.google.com comp.lang.ada:16924 Date: 2011-02-07T12:42:35+00:00 List-Id: On 2011-02-07, Simon Clubley wrote: > > I think the "change the value of 4" reference above is literally that and > does not mean changing a language accessible constant containing the value > of 4. > > I made this mistake once with a old Fortran compiler when I was a student. > > The constant would be placed into a memory location somewhere by the Fortran > compiler and then that memory location would be referenced at every point in > the code in which the literal value (the integer 4 in this example) was used > in a expression or a call to a subroutine. > 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. 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. Simon. -- Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP Microsoft: Bringing you 1980s technology to a 21st century world