Article View: comp.std.c++
Article #1397Re: pointer comparisons
From: John MAX Skaller
Date: Tue, 05 Jan 1993 06:03
Date: Tue, 05 Jan 1993 06:03
54 lines
2916 bytes
2916 bytes
In article <1993Jan4.200625.5680@lucid.com> jss@lucid.com (Jerry Schwarz) writes:
>In article <9300300.29980@mulga.cs.mu.OZ.AU>, fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON) writes:
>|>
>|> As I noted in a previous article, I don't agree with Scott Turners belief
>|> that base class subobjects are objects. To me, these are absurd
>|> consequences, and thus I conclude that the assumption used in deriving them
>|> must be flawed.
>
>Perhaps fjh would specify some of these "absurd consequences". I
>agree with Scott. Base class subobjects are objects. Anything else
>would be incomprehensible to me.
If an 'object' is something whose attributes are computed
from its internal state, then clearly subobjects need not
be objects. In the sense an object is 'self contained',
an 'instance' of an abstract class cannot be an object.
In particular, the semantics of a virtual function
in a subobject are not encapsulated in the subobject class
definition (especially for pure virtuals :-)
I suspect that only 'complete objects' can really
qualify to be genuine, true blue objects.
Which is not to say they shouldn't support object identity.
However the current rules do seem to provide object
identity --- if at all -- only for complete objects.
Since the current system does not provide subobjects
with object identity, nor do subobjects enjoy the same
'completeness' properties of complete objects, it is difficult
to argue that because subobjects are objects they ought to
have all the properties of objects---the converse argument
that because subobjects dont have the properties of
objects, they aren't objects is equally compelling and
equally meaningful (or devoid of such).
Is the issue not simple: either we waste bytes
to obtain object identity for subobjects or we dont.
If we do .. we waste bytes.
If we dont, then comparison of pointers in a subroutine
f(X* x1, X* x2) { if(x1==x2) ... }
is reliable only if f is called with complete object pointers.
I.e.: there is a precondition, and one that might be hard for
the caller to ensure.
--
;----------------------------------------------------------------------
JOHN (MAX) SKALLER, maxtal@extro.ucc.su.oz.au
Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
Technical Details
Message-ID:
<1993Jan5.060332.5262@ucc.su.OZ.AU>Path:
arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!metro!extro.ucc.su.OZ.AU!maxtalReferences:
<1993Jan1.155241.28217@ucc.su.OZ.AU> <9300300.29980@mulga.cs.mu.OZ.AU> <1993Jan4.200625.5680@lucid.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c++ Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!metro!extro.ucc.su.OZ.AU!maxtal From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) Subject: Re: pointer comparisons Message-ID: <1993Jan5.060332.5262@ucc.su.OZ.AU> Sender: news@ucc.su.OZ.AU Nntp-Posting-Host: extro.ucc.su.oz.au Organization: MAXTAL P/L C/- University Computing Centre, Sydney References: <1993Jan1.155241.28217@ucc.su.OZ.AU> <9300300.29980@mulga.cs.mu.OZ.AU> <1993Jan4.200625.5680@lucid.com> Date: Tue, 5 Jan 1993 06:03:32 GMT Lines: 54