From -2790741060167799042
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,e94695845965b249
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1992-12-16 00:51:43 PST
Newsgroups: comp.std.c++
Path: sparky!uunet!uunet.ca!frumious!pat
From: pat@frumious.uucp (Patrick Smith)
Subject: Re: Zero-length structures and pointer comparisons
Message-ID: <BzCG7K.2sG@frumious.uucp>
Date: Wed, 16 Dec 1992 08:42:55 GMT
References: <9234423.15066@mulga.cs.mu.OZ.AU> <1992Dec9.133956.29659@lth.se> <1992Dec9.191606.5665@lucid.com>
Organization: None
Lines: 38

dag@seldon.control.lth.se (Dag Bruck) writes:
| Suggested semantics: for any pointers p and q:
|
|       p == q   <=>   ptrcmp(p,q) == 0
|
|       p != q   <=>   ptrcmp(p,q) != 0
|
|       ptrcmp(p,q) < 0   <=>   ptrcmp(q,p) > 0


And transitivity:

   ptrcmp(p,q) <= 0 && ptrcmp(q,r) <= 0   =>   ptrcmp(p,r) <= 0
   ptrcmp(p,q) <= 0 && ptrcmp(q,r) <  0   =>   ptrcmp(p,r) <  0
   ptrcmp(p,q) <  0 && ptrcmp(q,r) <= 0   =>   ptrcmp(p,r) <  0


jss@lucid.com (Jerry Schwarz) writes:
|And
|
|       if p < q is defined,  ptrcmp(p,q) < 0   <=>  p < q


This strikes me as nice to have, but not essential.
Many applications of ptrcmp wouldn't need this property at all
(eg. using ptrcmp to navigate through a binary tree, with no
additional requirement on the ordering other than that it be
an ordering).

On the other hand, this might be fairly cheap, given that
we're already insisting on

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

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


