home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!gatech!concert!sas!mozart.unx.sas.com!sasghm
- From: sasghm@theseus.unx.sas.com (Gary Merrill)
- Subject: Re: Pointer/address reluctance
- Originator: sasghm@theseus.unx.sas.com
- Sender: news@unx.sas.com (Noter of Newsworthy Events)
- Message-ID: <Bsxn7A.H7v@unx.sas.com>
- Date: Thu, 13 Aug 1992 17:28:22 GMT
- References: <l8kteaINNp2c@exodus.Eng.Sun.COM>
- Nntp-Posting-Host: theseus.unx.sas.com
- Organization: SAS Institute Inc.
- Lines: 43
-
-
- In article <l8kteaINNp2c@exodus.Eng.Sun.COM>, linden@positive.Eng.Sun.COM (Peter van der Linden) writes:
- |> Can anyone explain the reluctance that some of the experts here
- |> have in equating "pointer" with "address"?
- |>
- |> The ANSI C standard displays no such inhibition, e.g. Section 3.4
- |> line 32 mentions "An address constant is a pointer to ..."
- |>
-
- First (and pardon what may appear as pedantry), the section you
- quote does *not* "equate" a pointer with an address. In fact, I
- am unaware of anywhere the standard discusses the concept of *address*.
- The section you quote (as well as section 3.3.3.2) establishes
- a relation between a *pointer* and an *address constant*. An
- *address constant* is a kind of *constant* (it is *not* an address),
- and a *pointer* is a type in C. There is no type in C called
- "address". Thus, in part, the reluctance you sense may simply be
- a resistance to "equating" a formal and precise concept (pointer)
- with an informal concept (address) that is not given precise meaning
- in the standard.
-
- Beyond this, while there is a clear intuitive association of
- "pointer" with "address", one may want to leave open the possibility
- of implementing pointers as something other than addresses (perhaps
- as an address together with some other component). In theory,
- I suppose one could conceive of an "abstract machine" and an
- implementation of C for this machine that did not implement a pointer
- as an address. The semantics for C leaves this open (and should).
- To do otherwise would be to limit the applicability of the language
- by an arbitrary restriction on its semantics.
-
- The issue here is conceptual and semantic. To "equate" a pointer
- with an address is akin to equating "array" with "contiguous sequence
- of memory locations". In short, it is to confuse a concept (or type)
- with one *possible* implementation of that concept. An array is
- *usually* implemented as a contiguous sequence of memory locations,
- but it need not be. What characterizes an array is its "algebra" --
- the set of operations that may be performed on it, the closure
- conditions of such operations, etc. Similarly for "pointer".
- --
- Gary H. Merrill [Principal Systems Developer, C Compiler Development]
- SAS Institute Inc. / SAS Campus Dr. / Cary, NC 27513 / (919) 677-8000
- sasghm@theseus.unx.sas.com ... !mcnc!sas!sasghm
-