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

  1. Newsgroups: comp.std.c++
  2. Path: sparky!uunet!munnari.oz.au!metro!extro.ucc.su.OZ.AU!maxtal
  3. From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
  4. Subject: Re: pointer comparisons
  5. Message-ID: <1993Jan5.060332.5262@ucc.su.OZ.AU>
  6. Sender: news@ucc.su.OZ.AU
  7. Nntp-Posting-Host: extro.ucc.su.oz.au
  8. Organization: MAXTAL P/L C/- University Computing Centre, Sydney
  9. References: <1993Jan1.155241.28217@ucc.su.OZ.AU> <9300300.29980@mulga.cs.mu.OZ.AU> <1993Jan4.200625.5680@lucid.com>
  10. Date: Tue, 5 Jan 1993 06:03:32 GMT
  11. Lines: 54
  12.  
  13. In article <1993Jan4.200625.5680@lucid.com> jss@lucid.com (Jerry Schwarz) writes:
  14. >In article <9300300.29980@mulga.cs.mu.OZ.AU>, fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON) writes:
  15. >|> 
  16. >|> As I noted in a previous article, I don't agree with Scott Turners belief
  17. >|> that base class subobjects are objects. To me, these are absurd 
  18. >|> consequences, and thus I conclude that the assumption used in deriving them
  19. >|> must be flawed.
  20. >
  21. >Perhaps fjh would specify some of these "absurd consequences".  I
  22. >agree with Scott.  Base class subobjects are objects. Anything else 
  23. >would be incomprehensible to me.
  24.  
  25.     If an 'object' is something whose attributes are computed
  26. from its internal state, then clearly subobjects need not
  27. be objects. In the sense an object is 'self contained',
  28. an 'instance' of an abstract class cannot be an object.
  29.  
  30.     In particular, the semantics of a virtual function
  31. in a subobject are not encapsulated in the subobject class
  32. definition (especially for pure virtuals :-)
  33.  
  34.     I suspect that only 'complete objects' can really
  35. qualify to be genuine, true blue objects. 
  36. Which is not to say they shouldn't support object identity.
  37. However the current rules do seem to provide object
  38. identity --- if at all -- only for complete objects.
  39.  
  40.     Since the current system does not provide subobjects
  41. with object identity, nor do subobjects enjoy the same
  42. 'completeness' properties of complete objects, it is difficult
  43. to argue that because subobjects are objects they ought to
  44. have all the properties of objects---the converse argument
  45. that because subobjects dont have the properties of
  46. objects, they aren't objects is equally compelling and
  47. equally meaningful (or devoid of such).
  48.  
  49.     Is the issue not simple: either we waste bytes
  50. to obtain object identity for subobjects or we dont.
  51.  
  52. If we do .. we waste bytes.
  53.  
  54. If we dont, then comparison of pointers in a subroutine
  55.  
  56.     f(X* x1, X* x2) { if(x1==x2) ... }
  57.  
  58. is reliable only if f is called with complete object pointers.
  59. I.e.: there is a precondition, and one that might be hard for
  60. the caller to ensure.
  61.  
  62. -- 
  63. ;----------------------------------------------------------------------
  64.         JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
  65.     Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
  66. ;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
  67.