Article View: comp.std.c++
Article #1314Re: Zero-length structures and pointer comparisons
From: John MAX Skaller
Date: Sat, 19 Dec 1992 20:37
Date: Sat, 19 Dec 1992 20:37
43 lines
2367 bytes
2367 bytes
In article <5347@holden.lulea.trab.se> jbn@lulea.trab.se (Johan Bengtsson) writes:
>Dag Bruck (dag@seldon.control.lth.se) wrote:
>: p == q <=> ptrcmp(p,q) == 0
>
>: p != q <=> ptrcmp(p,q) != 0
>
>: ptrcmp(p,q) < 0 <=> ptrcmp(q,p) > 0
>
>I think ptrcmp() is a good way to resolve this issue.
>
>There is only one possible remaining weakness (I think):
I disagree, but anyhow ...
>
>Any environment that relies on pointer translation (swizzling) to
>transport objects between executing processes will have difficulty
>maintaining a common total ordering for the pointers (IDs) of
>objects within those processes (Jim Adcock pointed this out).
>Examples include OODBMS and distributed systems. Code relying
>on ptrcmp() may be unportable to those environments.
>
>Should those environments be required to (somehow) provide special
>ptrcmp() functions, that look at some object ID (not memory address)?
>What if a program uses more than one pointer swizzling scheme (e.g.
>distributing some objects over communication channels, and storing other
>objects in an OODBMS)? Is it the users job to provide the ordering
>between those different object spaces?
>
>Anyone have a good solution for this?
>
Yes. First look at ==. It is already flawed. The rules
must be rewritten so that == has the given semantics only
in 'domestic' cases. The results of == can be implementation
defined in any cases the pointers are not derived by
'ordinary' operations. That lets OODBMS off the hook.
The same solution can be applied to ptrcmp now.
--
;----------------------------------------------------------------------
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:
<1992Dec19.203705.21919@ucc.su.OZ.AU>Path:
arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!metro!extro.ucc.su.OZ.AU!maxtalReferences:
<1992Dec9.133956.29659@lth.se> <5347@holden.lulea.trab.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: <1992Dec19.203705.21919@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> <5347@holden.lulea.trab.se> Date: Sat, 19 Dec 1992 20:37:05 GMT Lines: 43