home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / std / cplus / 2026 < prev    next >
Encoding:
Text File  |  1993-01-11  |  2.7 KB  |  67 lines

  1. Newsgroups: comp.std.c++
  2. Path: sparky!uunet!titan!lpi!pkt
  3. From: pkt@lpi.liant.com (Scott Turner)
  4. Subject: Re: pointer comparisons
  5. Message-ID: <1993Jan11.190959.5305@lpi.liant.com>
  6. Sender: pkt@lpi (Scott Turner)
  7. Organization: Liant Software Corporation
  8. References: <1992Dec31.170223.21637@lpi.liant.com> <1993Jan7.145511.718@lpi.liant.com> <1357@pivot-sts.sbi.com>
  9. Date: Mon, 11 Jan 1993 19:09:59 GMT
  10. Lines: 55
  11.  
  12. In article <1357@pivot-sts.sbi.com>, linke@sbi.sbi.com (User - Bill Linke) writes:
  13. > In article <1993Jan7.145511.718@lpi.liant.com>, pkt@lpi.liant.com (Scott Turner) writes:
  14. > > 
  15. > > Identity of objects is more of the essence than storage, so it would be
  16. > > problematic to define the former in terms of the latter.
  17. > Even this is not so clear, is it?  
  18.  
  19. It may be worth discussing.
  20.  
  21. > "Identity" means to me that we can
  22. > distinguish between two instances of a class 
  23.  
  24. Yes.
  25.  
  26. > using only the attributes of the class itself
  27. > (i.e. without using anything from derived classes which the class
  28. > might happen to be a base class of). This in turn implies that somewhere
  29. > within each instance is some storage which conceptually could hold some
  30. > identifying value.  (Otherwise, there would be no way for two instances to
  31. > have different attributes.)
  32.  
  33. How could this argument be meaningful?  If I have
  34.        int x=2, y=2;
  35. then in a typical implementation x and y are names of distinct objects,
  36. each of which has storage.  We can conceive of an atypical implementation
  37. which extra allows storage for identifying x and y with distinct keys.  But for
  38. practical purposes all that's necessary is that x and y have different
  39. addresses.  Whether or not the storage can conceptually hold an identifying
  40. value doesn't matter.
  41.  
  42. If we have objects of a type which requires no state, e.g.
  43.        struct {} a, b;
  44. then in order for them to have distinct identities an implementation
  45. might allocate addresses that don't point to valid memory.  Again, no
  46. storage is required.
  47.  
  48.  
  49. When I say that identity of objects is more of the essence than storage,
  50. here's the kind of thing I have in mind:
  51.        int x=2, y=2;
  52.        y = 3;
  53.        // Now the value of x is 2, not 3.  
  54. Why?  Because the declaration defines 2 distinct objects named x and y. 
  55.  
  56. To explain it in terms of storage is more obscure.  One would
  57. have to say that the storage reserved for the definition of x
  58. is required not to overlap the storage reserved for the definition of y.  
  59. And also mention that the state of the objects x and y resides in the 
  60. storage reserved by their definitions.
  61. --
  62. Prescott K. Turner, Jr.
  63. Liant Software Corp. (developers of LPI languages)
  64. 959 Concord St., Framingham, MA 01701 USA    (508) 872-8700
  65. UUCP: uunet!lpi!pkt                          Internet: pkt@lpi.liant.com
  66.