From -9010848106759261764
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,e94695845965b249
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1992-10-23 14:16:22 PST
Path: sparky!uunet!kithrup!hoptoad!decwrl!sdd.hp.com!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!att!allegra!alice!ark
From: ark@alice.att.com (Andrew Koenig)
Newsgroups: comp.std.c++
Subject: Re: Zero-length structures and pointer comparisons
Message-ID: <23986@alice.att.com>
Date: 23 Oct 92 22:27:19 GMT
Article-I.D.: alice.23986
References: <23937@alice.att.com> <1992Oct22.180951.24111@jyu.fi> <23978@alice.att.com> <1992Oct23.064817.2648@ucc.su.OZ.AU>
Reply-To: ark@alice.UUCP ()
Organization: AT&T Bell Laboratories, Murray Hill NJ
Lines: 18

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.
-- 
				--Andrew Koenig
				  ark@europa.att.com


