From 3476558045460628052
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,e94695845965b249
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1992-12-09 06:07:41 PST
Path: sparky!uunet!wupost!sdd.hp.com!think.com!enterpoop.mit.edu!eru.mt.luth.se!lunic!sunic!news.lth.se!dag
From: dag@seldon.control.lth.se (Dag Bruck)
Newsgroups: comp.std.c++
Subject: Re: Zero-length structures and pointer comparisons
Message-ID: <1992Dec9.133956.29659@lth.se>
Date: 9 Dec 92 13:39:56 GMT
References: <1992Dec2.111003.23102@jyu.fi> <1992Dec2.205330.10372@meaddata.com> <1992Dec4.070720.13056@lth.se> <1992Dec07.222242.18703@microsoft.com> <1992Dec8.103218.27689@lth.se> <9234423.15066@mulga.cs.mu.OZ.AU>
Sender: news@lth.se
Organization: Department of Automatic Control, Lund, Sweden
Lines: 17

In <comp.std.c++> fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON) writes:
>
>What I propose is that we define a *standard library function* which computes
>a total ordering on pointers.
>
>int compare_pointers(const void *, const void *);
>    /* Returns negative, zero, or positive in the same manner as strcmp().
>       Perhaps in the interests of tradition and unreadability it should
>       be called ptrcmp() instead of compare_pointers() :-) */

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


