home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / std / cplus / 1855 < prev    next >
Encoding:
Internet Message Format  |  1992-12-21  |  2.2 KB

  1. Path: sparky!uunet!spool.mu.edu!olivea!hal.com!darkstar.UCSC.EDU!daniel
  2. From: daniel@cse.ucsc.edu (Daniel R. Edelson)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: Zero-length structures and pointer comparisons
  5. Message-ID: <1gtblgINN72@darkstar.UCSC.EDU>
  6. Date: 18 Dec 92 20:17:52 GMT
  7. References: <1992Dec15.162202.11231@ucc.su.OZ.AU> <1992Dec16.201044.2968@microsoft.com> <1992Dec18.193554.18588@ucc.su.OZ.AU>
  8. Organization: University of California, Santa Cruz (CE/CIS Boards)
  9. Lines: 46
  10. NNTP-Posting-Host: oak.ucsc.edu
  11.  
  12. In article <1992Dec18.193554.18588@ucc.su.OZ.AU> maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
  13. >In article <1992Dec16.201044.2968@microsoft.com> jimad@microsoft.com (Jim Adcock) writes:
  14.  
  15. >    I know what you are saying but dont see it.
  16. >ARM p74:"two pointers to the same object compare equal".
  17. >Any program for which this is not true cannot be conforming,
  18. >neither strictly nor non-strictly, it is non-conforming, it is
  19. >not in fact a C++ program.
  20.  
  21. I think this is a requirement on implementations, rather than
  22. a requirement on programs. 
  23.  
  24. >    Or have I got this wrong?
  25.  
  26. You might have it backwards.
  27.  
  28. >    For this reason I think the ARM requirement is unworkable,
  29. >and must be modified. The rule should state that pointers
  30. >derived from the same object directly in the program must
  31. >compare equal. Pointers obtained from the OS need not follow
  32. >this rule, in that case it is implementation defined.
  33.  
  34. Neither the C standard nor the C++ standard discusses any OS.
  35. (As far as I recall.)
  36.  
  37. A call to the operating system should be viewed as
  38. a call to an extension supplied by the language provider. 
  39. A program that uses an extension can be conforming but
  40. not strictly conforming, as per the X3J16 definitions. 
  41.  
  42. Thus, I think a better rule is:
  43.     ``In a strictly conforming program, two pointers
  44.     to the same object compare equal.''
  45. Thus, this property need not be true in any program that
  46. calls the operating system.
  47.  
  48. I think actually that ramifications of multiple inheritance 
  49. and multiple object-addresses should be explicitly addressed
  50. in the rule, such as by saying that a pointer to a base-class
  51. subobject is not a pointer to the same object as a pointer
  52. to the most-derived class object.
  53.  
  54. >        JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
  55.  
  56. Daniel Edelson
  57. daniel@cse.ucsc.edu
  58.