home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / std / cplus / 1928 < prev    next >
Encoding:
Text File  |  1992-12-28  |  2.2 KB  |  47 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: <1992Dec28.151146.16840@lpi.liant.com>
  6. Sender: pkt@lpi (Scott Turner)
  7. Organization: Liant Software Corporation
  8. References: <BzDs2x.wA@frumious.uucp> <1992Dec17.151642.9954@bcrka451.bnr.ca> <1992Dec18.181029.1061@taumet.com> <1992Dec24.011254.1982@microsoft.com>
  9. Date: Mon, 28 Dec 1992 15:11:46 GMT
  10. Lines: 35
  11.  
  12. In article <1992Dec24.011254.1982@microsoft.com>, jimad@microsoft.com (Jim Adcock) writes:
  13. > What needs to be made clear includes what is meant by "point to the
  14. > same object."  As in my example the pointers *do* point to the same object,
  15. > and they do compare equal.  It's just that one pointer refers to an
  16. > enclosing object, and one pointer the enclosed object.  Same object,
  17. > just not identically the same object.  
  18.  
  19. This explanation of your example could be more clear.  
  20. If one pointer refers to an an enclosing object, and another to an enclosed
  21. object, that sounds like different objects to me.
  22.  
  23. I've been advocating a strong relationship between pointer comparison
  24. and identity of the objects pointed to.  It occurs to me that pointers
  25. of type void* do not fit into this framework in C++, and not really in
  26. C either.  If we want a guarantee that
  27.     (void*)&a == (void*)&a
  28. then how would the standard specify it?
  29.  
  30. > Ultimately, I do not believe worrying about these pointer "details" 
  31. > is very important unless one first decides what properties of object
  32. > identity C++ objects must have and why.  The current permission of
  33. > C++ compilers to create temporaries at will kind of blows object identity
  34. > out of the water.  Why worry about pointer equality, then?
  35.  
  36. I'd be happy to have a more precise description of C++ objects and their
  37. identity, but temporaries are not much of a problem.
  38. Programs rely on object identity via pointers, references, and lvalues.
  39. 12.2 of the ARM and working paper sanctions the introduction of temporaries,
  40. but no one interprets this as affecting pointer, reference, and lvalue
  41. expressions.  
  42. --
  43. Prescott K. Turner, Jr.
  44. Liant Software Corp. (developers of LPI languages)
  45. 959 Concord St., Framingham, MA 01701 USA    (508) 872-8700
  46. UUCP: uunet!lpi!pkt                          Internet: pkt@lpi.liant.com
  47.