Article View: comp.std.c++
Article #5Re: Zero-length structures and pointer comparisons
From: John MAX Skaller
Date: Wed, 28 Oct 1992 18:59
Date: Wed, 28 Oct 1992 18:59
38 lines
2691 bytes
2691 bytes
In article <1992Oct26.170404.1904@microsoft.com> jimad@microsoft.com (Jim Adcock) writes:
[< on pointers .. total ordering]
>This would be a big step in the wrong direction of tying C/C++ to one
>particularly simple and naive memory model, rather than allowing C/C++ to
>be reasonably ported to all of today, yesterday's and tomorrow's computer
>architectures. IMHO. 32-bit flat architectures are simply one stop on
>the way to the future. There are lots of interesting CPU architectures
>that aren't 0:32. At the very least, 16:32 and 32:32 architectures are
>becoming commonplace, as is multiprocessing. Would people force all machines
>now and in the future into the 0:32 straight-jacket? This would be very
>short-sighted IMHO.
I agree but I dont see what this has to do with the issue
of whether < is required to be a total order. If all pointers on
a machine are the same length, and alisaing is not allowed,
then a bitwise comparison yields a total order. That ordering
is meaningless in itself, but as Andrew Koenig pointed out it
is useful for putting pointers in data structures requiring
a type T with a total order.
>
>On the contrary, let's head in the opposite direction, and make the
>cast from ptr to int and back again strictly implementation defined,
>thus opening C++ up to architectures with moveable objects, and opening
>the door to reasonable compacting memory management schemes.
I'm not sure whether casting to/from int is relevant here,
except that *if* you can do it at all, you get a total order.
If you made it implementation defined (i.e. the casts were REQUIRED
to work) then you would either no longer have a total order
or you would have to have quite big 'int' values.
--
;----------------------------------------------------------------------
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:
<1992Oct28.185947.27216@ucc.su.OZ.AU>Path:
arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!iggy.GW.Vitalink.COM!cs.widener.edu!eff!sol.ctr.columbia.edu!caen!batcomputer!munnari.oz.au!metro!extro.ucc.su.OZ.AU!maxtalReferences:
<1992Oct19.055511.18826@jyu.fi> <1992Oct21.153904.13965@ucc.su.OZ.AU> <1992Oct26.170404.1904@microsoft.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c++ Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!iggy.GW.Vitalink.COM!cs.widener.edu!eff!sol.ctr.columbia.edu!caen!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: <1992Oct28.185947.27216@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: <1992Oct19.055511.18826@jyu.fi> <1992Oct21.153904.13965@ucc.su.OZ.AU> <1992Oct26.170404.1904@microsoft.com> Date: Wed, 28 Oct 1992 18:59:47 GMT Lines: 38