home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / std / cplus / 1894 < prev    next >
Encoding:
Text File  |  1992-12-22  |  2.4 KB  |  50 lines

  1. Newsgroups: comp.std.c++
  2. Path: sparky!uunet!spool.mu.edu!agate!ames!sun-barr!cs.utexas.edu!torn!nott!bnrgate!bcrka451!bcrki65!sjm
  3. From: sjm@bcrki65.bnr.ca (Stuart MacMartin)
  4. Subject: Re: Pointer comparisons
  5. Message-ID: <1992Dec22.140212.12579@bcrka451.bnr.ca>
  6. Sender: 5E00 Corkstown News Server
  7. Organization: Bell-Northern Research Ltd., Ottawa, Canada
  8. References: <BzDs2x.wA@frumious.uucp> <1992Dec17.151642.9954@bcrka451.bnr.ca> <1992Dec19.001851.22116@microsoft.com>
  9. Date: Tue, 22 Dec 1992 14:02:12 GMT
  10. Lines: 38
  11.  
  12. In article <1992Dec19.001851.22116@microsoft.com> jimad@microsoft.com (Jim Adcock) writes:
  13. >In article <1992Dec17.151642.9954@bcrka451.bnr.ca> sjm@bcrki65.bnr.ca (Stuart MacMartin) writes:
  14. >|>4) If two pointers p and q (of the same type) are obtained through
  15. >|>   sequences of "normal" operations, then
  16. >|>
  17. >|>      p == q   <==>   p and q point to the same object
  18. >|
  19. >|I could not find this statement in the current wording.  Is there a 
  20. >|reason why the current wording is weaker than this?
  21. >
  22. >Again, a simple counterexample is as follows:
  23. >
  24. [Class A with no state; class B is derived from A and contains an A.
  25.  Compare pointer to base A of B against pointer to member A of B]
  26.  
  27. 1.  I would be annoyed if there was gratuitous padding here.
  28.     I want to be able to have T_interface and  T_implementation : public T_interface.
  29.     
  30. 2.  Perhaps there is a philosophical argument that might resolve this issue.
  31.     If two objects have the same interface but no state (or constant state), and
  32.     they have the same lifetime, are they in fact the same object?  Or, perhaps,
  33.     can they be treated as if they are the same object?
  34.  
  35.     The rule about new returning different addresses is needed because the objects
  36.     have different lifetimes and so part of their state (their existence) differs,
  37.     and the objects can be observed to be different.  In your example, I see no way
  38.     of determining which A is which other than by looking at the pointers.  Can I
  39.     even tell if there really are two As?  Mightn't one have been optimized away?
  40.  
  41.     Maybe someone who feels strongly that there is only one 1, or conversely that
  42.     there are an infinite number of identical 1s can comment.  Seems like a
  43.     similar concept.
  44.     
  45. Stuart
  46. --
  47. : Stuart MacMartin                                    email: sjm@bnr.ca      :
  48. : Bell-Northern Research                              phone: (613) 763-5625  :
  49. : PO Box 3511, Stn C, Ottawa, K1Y-4H7, CANADA    Standard disclaimers apply. :
  50.