🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Zero-length structures and pointer comparisons

#1256
From: Patrick Smith
Date: Wed, 16 Dec 1992 08:42
38 lines
1419 bytes
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
Technical Details
Message-ID: <BzCG7K.2sG@frumious.uucp>
Path: arc1-ca.pugleaf.net!sparky!uunet!uunet.ca!frumious!pat
References: <9234423.15066@mulga.cs.mu.OZ.AU> <1992Dec9.133956.29659@lth.se> <1992Dec9.191606.5665@lucid.com>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c++
Path: arc1-ca.pugleaf.net!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