Article View: comp.std.c++
Article #1148Re: Pointer comparisons
From: Jerry Schwarz
Date: Wed, 23 Dec 1992 18:24
Date: Wed, 23 Dec 1992 18:24
38 lines
1212 bytes
1212 bytes
Jim Adcock is advocating that under some circumstances it
is ok for a compiler to put two A objects at the same location.
His example is
|> class A {};
|>
|> class B : public A
|> {
|> public:
|> A a;
|> };
|>
B b ;
Where he claims it is ok for b.a and (B&)a to compare equal.
I don't agree, but I'm wondering exactly what criteria he is applying.
Does anything go for A's. E.g.
void f() {
A a1, a2 ; // can &a1==&a2
... ;
}
Is it only ok for "empty" classes? How about
struct D { int i; int j ; } ;
void f() {
D d1, d2 ;
... d1.i ... d2.j ... // never use d1.j or d2.i
}
Can &d1==&d2.
-- Jerry Schwarz
Technical Details
Message-ID:
<1992Dec23.182456.17185@lucid.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!lucid.com!lucid.com!jssReferences:
<1992Dec16.202711.22367@bcrka451.bnr.ca> <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!stanford.edu!lucid.com!lucid.com!jss From: jss@lucid.com (Jerry Schwarz) Subject: Re: Pointer comparisons Message-ID: <1992Dec23.182456.17185@lucid.com> Sender: usenet@lucid.com Reply-To: jss@lucid.com (Jerry Schwarz) Organization: Lucid, Inc. References: <1992Dec16.202711.22367@bcrka451.bnr.ca> <BzDs2x.wA@frumious.uucp> <1992Dec17.151642.9954@bcrka451.bnr.ca> <1992Dec19.001851.22116@microsoft.com> Date: Wed, 23 Dec 92 18:24:56 GMT Lines: 38