From 8974038008284526733
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,e94695845965b249
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1992-12-16 20:23:53 PST
Newsgroups: comp.std.c++
Path: sparky!uunet!elroy.jpl.nasa.gov!usc!zaphod.mps.ohio-state.edu!uunet.ca!frumious!pat
From: pat@frumious.uucp (Patrick Smith)
Subject: Re: Zero-length structures and pointer comparisons
Message-ID: <BzDJHu.t2@frumious.uucp>
Date: Wed, 16 Dec 1992 22:51:29 GMT
Reply-To: uunet.ca!frumious!pat
References: <1992Dec12.154918.2220@ucc.su.OZ.AU> <1992Dec14.225659.24225@microsoft.com> <1992Dec16.150144.6004@ucc.su.OZ.AU>
Organization: None
Lines: 33

maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
|	I'm not yet convinced it need bear ANY relation to
|	==, !=, < etc on pointers.

["it" == ptrcmp]


Surely one would want to insist on

   p == q   =>   ptrcmp(p,q) == 0

If this weren't true, one wouldn't be able to use ptrcmp as a basis
for organizing an ordered binary tree for searching.  Are there any
likely-to-be-common uses of ptrcmp which don't need this assumption?

Unfortunately, meeting this condition might be expensive on
segmented architectures (according to the many other postings
on this subject).


The converse,

   ptrcmp(p,q) == 0   =>   p == q

seems not quite as essential, but still very useful.  Can anyone
describe an otherwise reasonable implementation of ptrcmp which
would _not_ meet this condition?  If not, what's the harm in
asking for it?

-- 
Patrick Smith
uunet.ca!frumious!pat
pat%frumious.uucp@uunet.ca


