Article View: comp.std.c++
Article #1183Re: pointer comparisons
From: Scott Turner
Date: Thu, 31 Dec 1992 15:27
Date: Thu, 31 Dec 1992 15:27
42 lines
2373 bytes
2373 bytes
In article <1992Dec30.184614.5551@microsoft.com>, jimad@microsoft.com (Jim Adcock) writes:
> In article <1992Dec27.050118.1628@lpi.liant.com> pkt@lpi.liant.com (Scott Turner) writes:
> |The desired feature is:
> |Two pointers to the same type, which point to distinct objects
> |of that type, compare not equal.
>
> Can you define your terms for us?
> I'm sure each of these things seems clear to you, yet they are not.
I'm talking about expressions with equality operators,
i.e. 5.10 of the ARM. By "two pointers to the same type" I mean
to address just those cases in which both operands are pointer-type
expressions, and in which the types of the expressions are
[const/volatile] pointer to [const/volatile] type A
and
[const/volatile] pointer to [const/volatile] type B
where A and B are the "same type". (I spell this out to indicate that
this is concerned with the static expression type, not the type of some
object, possibly enclosing the one pointed to.)
"Same type" is a term used repeatedly in the ARM. It has its limitations,
but is adequate for my purpose.
"Point to distinct objects" would imply two things:
(1) Each operand points to one object (not a function, and is not null or
invalid).
(2) The objects are not identicial. I hope to say more about this in
another article.
The case I'm concerned with is limited to "objects of that type", i.e.
each operand points to a properly constructed object of type A (which may
be a subobject of an enclosing object constructed with a different type).
"Compare not equal" is self-evident; the C standard uses the same kind
of wording. It means that the result of the operator != is 1 (TRUE) and
the result of the operator == is 0 (FALSE).
--
Prescott K. Turner, Jr.
Liant Software Corp. (developers of LPI languages)
959 Concord St., Framingham, MA 01701 USA (508) 872-8700
UUCP: uunet!lpi!pkt Internet: pkt@lpi.liant.com
Technical Details
Message-ID:
<1992Dec31.152700.21521@lpi.liant.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!titan!lpi!pktReferences:
<1992Dec27.050118.1628@lpi.liant.com> <1992Dec30.184614.5551@microsoft.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c++ Path: arc1-ca.pugleaf.net!sparky!uunet!titan!lpi!pkt From: pkt@lpi.liant.com (Scott Turner) Subject: Re: pointer comparisons Message-ID: <1992Dec31.152700.21521@lpi.liant.com> Sender: pkt@lpi (Scott Turner) Organization: Liant Software Corporation References: <1992Dec27.050118.1628@lpi.liant.com> <1992Dec30.184614.5551@microsoft.com> Date: Thu, 31 Dec 1992 15:27:00 GMT Lines: 42