home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / c / 12290 < prev    next >
Encoding:
Text File  |  1992-08-13  |  2.7 KB  |  57 lines

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