Article View: comp.std.c++
Article #1301Re: Zero-length structures and pointer comparisons
From: John MAX Skaller
Date: Fri, 18 Dec 1992 19:22
Date: Fri, 18 Dec 1992 19:22
44 lines
2340 bytes
2340 bytes
In article <BzCG7K.2sG@frumious.uucp> pat@frumious.uucp (Patrick Smith) writes:
>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
>|
>| if p < q is defined, ptrcmp(p,q) < 0 <=> p < q
>
>On the other hand, this might be fairly cheap, given that
>we're already insisting on
>
> p == q => ptrcmp(p,q) == 0
>
I'm NOT agreeing with this at present. I reject any relationship
between p ? q and ptrcmp. On some machines any such relationship
might make ptrcmp unimplementable, and thus defeat the proposal completely.
It is only Jims suggestion that ptrcmp might always return 0 that
makes it possible to make its existence mandatory.
In fact, p==q iff objects equal is unimplementable on some machines.
That is, even the existing ARM requirement is unworkable.
Consider that p < q is implementation defined, so it could mean
almosty anything. It does not have to obey ANY rules, unless
the pointers are into the same array.
As such tying < to ptrcmp, or any such function which requires
a total order immediately makes the specification inconsistent,
and thus it will have to be rejected.
Lets stop having 'wish lists' here and analyse the problem
properly. The first thing we have to do is fix the
unworkable requirement that p==q iff p,q point to same object.
--
;----------------------------------------------------------------------
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:
<1992Dec18.192202.17023@ucc.su.OZ.AU>Path:
arc1-ca.pugleaf.net!sparky!uunet!pmafire!news.dell.com!natinst.com!cs.utexas.edu!usc!rpi!batcomputer!munnari.oz.au!metro!extro.ucc.su.OZ.AU!maxtalReferences:
<1992Dec9.133956.29659@lth.se> <1992Dec9.191606.5665@lucid.com> <BzCG7K.2sG@frumious.uucp>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c++ Path: arc1-ca.pugleaf.net!sparky!uunet!pmafire!news.dell.com!natinst.com!cs.utexas.edu!usc!rpi!batcomputer!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: <1992Dec18.192202.17023@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: <1992Dec9.133956.29659@lth.se> <1992Dec9.191606.5665@lucid.com> <BzCG7K.2sG@frumious.uucp> Date: Fri, 18 Dec 1992 19:22:02 GMT Lines: 44