From 6970940378460186233
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,e94695845965b249
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1992-10-28 06:23:02 PST
Newsgroups: comp.std.c++
Path: 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

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 ------------------


