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

  1. Newsgroups: comp.std.c++
  2. Path: sparky!uunet!microsoft!wingnut!jimad
  3. From: jimad@microsoft.com (Jim Adcock)
  4. Subject: Re: pointer comparisons
  5. Message-ID: <1993Jan06.201647.7602@microsoft.com>
  6. Date: 06 Jan 93 20:16:47 GMT
  7. Organization: Microsoft Corporation
  8. References: <1993Jan4.200625.5680@lucid.com> <1993Jan5.060332.5262@ucc.su.OZ.AU> <1993Jan5.222300.29535@lucid.com>
  9. Lines: 120
  10.  
  11. In article <1993Jan5.222300.29535@lucid.com> jss@lucid.com (Jerry Schwarz) writes:
  12. |I completely disagree with the premise. Maybe we are using 
  13. |"object" in different senses.  An important "attribute" of
  14. |an object (defined as a region of storage by both the C 
  15. |standard and the ARM) is its relationship to other regions
  16. |of storage.
  17.  
  18. Whether or not people agree with a particular set of premises it might
  19. be nice to start with at least *one* explicitly stated set of premises
  20. and terminology that remains consistent with the clearly stated requirements
  21. of the ARM, and which remains relatively consistent with most parts of
  22. most implementations of the ARM.
  23.  
  24. |To take a simple example
  25. |
  26. |    int a[10];
  27. |
  28. |It is an important attribute of a[2] that it is the 3rd
  29. |subobject of a 10 element array.  
  30. |
  31. |struct S { int i ; int j ; } s ;
  32. |
  33. |It is an important attribute of s.j that it is the "j" subobject
  34. |of s.   
  35.  
  36. I wouldn't call either of these things "subobjects."  I would call then
  37. elements and members respectively, and would require that elements and
  38. members are indeed "objects" which follow all the rules of "objects"
  39. whatever those rules might be.  I don't think this is much of an issue --
  40. excepting deciding on what rules all "objects" must obey.  A bigger
  41. issue seems to be whether or not inherited base parts represent 
  42. "objects" in their own rights, or are they not "objects."  If
  43. they are "objects" then they must follow all the rules that 
  44. [someone someday] establishes for "objects" otherwise they could follow
  45. some other set of rules established for "base parts" or whatever you
  46. want to call them.  My claim would be that the [unstated] rules for
  47. base parts as implied by ARM and common implementations are sufficiently
  48. different from other "objects" that such can't reasonably be considered
  49. as part of the "object" rules.  At least I can't think of such a set
  50. of consistent rules.  If you can come up with a consistent set of rules
  51. that match ARM requirements and most of most implementations -- hey,
  52. then go for it!
  53.  
  54. |If you prefer to use a word other than "subobject" to describe
  55. |this relationship, I suppose you can do so.  But however you
  56. |describe it, it is an important concept in the semantics of C++.
  57.  
  58. Agreed, its just that those base parts don't necessarily follow
  59. all the rules of "objects"
  60.  
  61. |Perhaps you disagree that a[2] or s.j are "objects"?  If so
  62. |then I think you should reconsider your terminology.  "object"
  63. |is the term used throughout the C standard and ARM for this
  64. |concept. 
  65.  
  66. I agree that elements and members are objects.  Base parts
  67. are neither elements nor members, but base parts can have
  68. elements and members.  I do not consider a base part in
  69. itself to be an object.
  70.  
  71. |And a "base subobject" bears an analogous relationship to the
  72. |containing object(s).  
  73.  
  74. I disagree.  I consider the analogy to be sufficiently weak 
  75. that I don't think a consistent set of rules can be developed
  76. for both base parts and other objects that reasonably captures
  77. the behavior of both categories.
  78.  
  79. |A virtual function call (as I noted in
  80. |another item I posted recently) requires taking a base object
  81. |and finding the appropriate derived object containing the base
  82. |object.  This can't be done based solely on the contents of
  83. |the base object.  
  84.  
  85. Note that this is considerably different behavior than built-in
  86. objects, "C" struct objects, standalone C++ objects, member objects, 
  87. and element objects.  Thus I believe these base parts do not 
  88. represent "objects" but rather fall into a different category of thingees.
  89.  
  90. |The data members of a class are also subobjects according to
  91. |my understanding.  You're even disallowing that?  
  92.  
  93. I don't think that's anyone's intent.
  94.  
  95. ||>     Is the issue not simple: either we waste bytes
  96. ||> to obtain object identity for subobjects or we dont.
  97. ||> 
  98. |
  99. |I can phrase begging questions too. Either we implement the
  100. |language correctly or we fudge, save a byte and hope nobody
  101. |notices. 
  102.  
  103. How can anyone implement the language "correctly" if you are
  104. going to define "correctness" in terms of your undefined requirements
  105. that neither you, ARM, nor the ANSI-C base document calls out?
  106.  
  107. If an implementation does not contradict clearly stated requirements of
  108. the  base documents, then the language HAS been implemented correctly.  
  109. If this is unacceptable to you, then write a up a clear, complete, 
  110. set of rules of what you say objects are and aren't and what properties
  111. they do have and don't have *in the language* and get the
  112. rest of the C++ committee to buy-off on your definitions.
  113. Then implementations can implement these agreed-upon set of rules
  114. in the famous "as-if" manner, and no one can complain.  Until
  115. then we simply are arguing for our particular favorite *implementation*
  116. [NOT *LANGUAGE*] and arguing against the other guy's implementation.
  117.  
  118. |Apparently the issue isn't simple.  There is a fundamental
  119. |disagreement about the semantics of C++.  If that disagreement
  120. |is resolved it will tell us what is a legal implementation.
  121. |We can use the consequences for storage layout and sizes as
  122. |a criterion for determining the semantics, but it can't be
  123. |the sole criterion.
  124.  
  125. We're not even yet to the stage of fundamental disagreement,
  126. because neither camp[s] has clearly defined what they're talking
  127. about.  Many people are even clear yet that they're being
  128. unclear.  Once there are clear statements of what the various
  129. positions are, *then* the possibility exists of working through
  130. any disagreement, and reaching a workable compromise.
  131.