🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #1138

Re: Pointer comparisons

#1138
From: Stuart MacMartin
Date: Tue, 22 Dec 1992 14:02
38 lines
2541 bytes
In article <1992Dec19.001851.22116@microsoft.com> jimad@microsoft.com (Jim Adcock) writes:
>In article <1992Dec17.151642.9954@bcrka451.bnr.ca> sjm@bcrki65.bnr.ca (Stuart MacMartin) writes:
>|>4) If two pointers p and q (of the same type) are obtained through
>|>   sequences of "normal" operations, then
>|>
>|>      p == q   <==>   p and q point to the same object
>|
>|I could not find this statement in the current wording.  Is there a 
>|reason why the current wording is weaker than this?
>
>Again, a simple counterexample is as follows:
>
[Class A with no state; class B is derived from A and contains an A.
 Compare pointer to base A of B against pointer to member A of B]

1.  I would be annoyed if there was gratuitous padding here.
    I want to be able to have T_interface and  T_implementation : public T_interface.
    
2.  Perhaps there is a philosophical argument that might resolve this issue.
    If two objects have the same interface but no state (or constant state), and
    they have the same lifetime, are they in fact the same object?  Or, perhaps,
    can they be treated as if they are the same object?

    The rule about new returning different addresses is needed because the objects
    have different lifetimes and so part of their state (their existence) differs,
    and the objects can be observed to be different.  In your example, I see no way
    of determining which A is which other than by looking at the pointers.  Can I
    even tell if there really are two As?  Mightn't one have been optimized away?

    Maybe someone who feels strongly that there is only one 1, or conversely that
    there are an infinite number of identical 1s can comment.  Seems like a
    similar concept.
    
Stuart
--
: Stuart MacMartin                                    email: sjm@bnr.ca      :
: Bell-Northern Research                              phone: (613) 763-5625  :
: PO Box 3511, Stn C, Ottawa, K1Y-4H7, CANADA    Standard disclaimers apply. :
Technical Details
Message-ID: <1992Dec22.140212.12579@bcrka451.bnr.ca>
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!agate!ames!sun-barr!cs.utexas.edu!torn!nott!bnrgate!bcrka451!bcrki65!sjm
References: <BzDs2x.wA@frumious.uucp> <1992Dec17.151642.9954@bcrka451.bnr.ca> <1992Dec19.001851.22116@microsoft.com>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c++
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!agate!ames!sun-barr!cs.utexas.edu!torn!nott!bnrgate!bcrka451!bcrki65!sjm
From: sjm@bcrki65.bnr.ca (Stuart MacMartin)
Subject: Re: Pointer comparisons
Message-ID: <1992Dec22.140212.12579@bcrka451.bnr.ca>
Sender: 5E00 Corkstown News Server
Organization: Bell-Northern Research Ltd., Ottawa, Canada
References: <BzDs2x.wA@frumious.uucp> <1992Dec17.151642.9954@bcrka451.bnr.ca> <1992Dec19.001851.22116@microsoft.com>
Date: Tue, 22 Dec 1992 14:02:12 GMT
Lines: 38