Article View: comp.std.c++
Article #1Re: Zero-length structures and pointer comparisons
From: John MAX Skaller
Date: Wed, 28 Oct 1992 18:00
Date: Wed, 28 Oct 1992 18:00
32 lines
2067 bytes
2067 bytes
In article <23986@alice.att.com> ark@alice.UUCP () writes:
>In article <1992Oct23.064817.2648@ucc.su.OZ.AU> maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
>
>> I dont understand how the segmented architectures have anything to do with it.
>> It is only necessary that there be *an* total order, it makes
>> no difference what that order is.
>
>Consider a machine where addresses are (segment, offset) with the actual
>address being determined by adding the segment and the offset.
>If the compiler adopts the convention that all pointers to elements
>of the same array will have the same segment pointer, then it can
>do < > <= >= comparisons (which are valid only for pointers to
>elements of the same array) by comparing the offsets and ignoring the
>segments. This is not a legitimate ordering, because it might be that
>for elements of two different arrays with the same offset, all three
>of < > == would return false.
Yes, but IF the language required a total ordering the
compiler would be REQUIRED to normalise the pointers, which is
precisely what Borland C++ does for real mode 8086 code anyhow
in many circumstances.
Any comments on the harder issue of
"two pointers to the same object compare equal" (p74)
--
;----------------------------------------------------------------------
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.180039.20655@ucc.su.OZ.AU>Path:
arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!metro!extro.ucc.su.OZ.AU!maxtalReferences:
<23978@alice.att.com> <1992Oct23.064817.2648@ucc.su.OZ.AU> <23986@alice.att.com>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: <1992Oct28.180039.20655@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: <23978@alice.att.com> <1992Oct23.064817.2648@ucc.su.OZ.AU> <23986@alice.att.com> Date: Wed, 28 Oct 1992 18:00:39 GMT Lines: 32