From -6089938785496519169
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,e94695845965b249
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1992-10-23 09:11:50 PST
Newsgroups: comp.std.c++
Path: sparky!uunet!ukma!darwin.sura.net!sgiblab!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: <1992Oct23.064817.2648@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: <23937@alice.att.com> <1992Oct22.180951.24111@jyu.fi> <23978@alice.att.com>
Date: Fri, 23 Oct 1992 06:48:17 GMT
Lines: 44

In article <23978@alice.att.com> ark@alice.UUCP () writes:
>In article <1992Oct22.180951.24111@jyu.fi> sakkinen@jyu.fi (Markku Sakkinen) writes:
>
>> Thus, while Jim Adcock, in the posting to which you had originally replied,
>> was quite happy with the situation as is, you would be in favour of a change
>> in the standard to make pointer types totally ordered?
>
>Yes, I would.  Of course, my preference may not count for all that much,
>given the number of machines out there with segmented architectures.
>It would be nice if someone with access to real data could do a
>cost/benefit analysis.

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. Certainly there is no problem
on any of the 80x86 machines in obtaining an arbitrary total order
on pointers. On the 486 in 32 bit protected mode pointers are
48 bits and can just be compared bitwise just as on a linear
address machine.

The problems that exist on such machines are not so much with <
but with == and !=. In principle on the 486 two machine
pointers---different bit patterns---can point to the same
object in such a way that it is NOT possible to compare them
for equality without invoking the operating system.

(This will occur if two segments are overlaid, for example,
one being read only and the other read/write. It can also
occur on a linear address machine (or the 486) if the virtual
memory systemn allows remapping of the linear address space.
Here two different linear addresses might point to the same object)

Without placing constraints on architectures the best that can be said
is that if the bit patterns of two pointers are equal, they
point to the same object. If they are not equal, nothing further
is known. Even *this* is not true if the pointers are from
two different tasks.


-- 
;----------------------------------------------------------------------
        JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
	Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------


