🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Zero-length structures and pointer comparisons

#1217
From: John MAX Skaller
Date: Sat, 12 Dec 1992 15:54
28 lines
1693 bytes
In article <1992Dec9.133956.29659@lth.se> dag@seldon.control.lth.se (Dag Bruck) writes:
>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

	Are you SURE you need this? Why should == and ptrcmp
be in any way related? In particular, on the 8086 if
ptrcmp was a bitwise compare it would yield a total order,
but we would have

	p == q && ptrcmp(p,q) !=0


-- 
;----------------------------------------------------------------------
        JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
	Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
Technical Details
Message-ID: <1992Dec12.155417.2628@ucc.su.OZ.AU>
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!metro!extro.ucc.su.OZ.AU!maxtal
References: <1992Dec8.103218.27689@lth.se> <9234423.15066@mulga.cs.mu.OZ.AU> <1992Dec9.133956.29659@lth.se>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c++
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!metro!extro.ucc.su.OZ.AU!maxtal
From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
Subject: Re: Zero-length structures and pointer comparisons
Message-ID: <1992Dec12.155417.2628@ucc.su.OZ.AU>
Sender: news@ucc.su.OZ.AU
Nntp-Posting-Host: extro.ucc.su.oz.au
Organization: MAXTAL P/L C/- University Computing Centre, Sydney
References: <1992Dec8.103218.27689@lth.se> <9234423.15066@mulga.cs.mu.OZ.AU> <1992Dec9.133956.29659@lth.se>
Date: Sat, 12 Dec 1992 15:54:17 GMT
Lines: 28