From 3943754647987856698
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,e94695845965b249
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1992-11-30 13:46:13 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: <1992Nov30.195202.14370@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: <1992Nov4.080805.13496@jyu.fi> <1992Nov27.091056.3895@jyu.fi>
Date: Mon, 30 Nov 1992 19:52:02 GMT
Lines: 45

In article <1992Nov27.091056.3895@jyu.fi> sakkinen@jyu.fi (Markku Sakkinen) writes:
>> Then, if there is no total order within pointers of the same type,
>> essentially one or more of the following holds:
>> 
>> A) '<' is not transitive, i.e. p < q and q < r does not imply p < q.
>> 
>> B) '<' (or rather '<=') is not connective, i.e. there might be p and q
>>    such that neither p = q, p < q nor q < p holds.
>> 
>> C) All usual relationships between the different relational operators
>>    need not hold (e.g. p < q does not imply q > p).
>> 
>> I have difficulty to imagine any useful programming idioms that would
>> depend on either A, B, or C (or on the exact way in which a particular
>> implementation makes pointers not be totally ordered),
>> but you speak about tons of legal programs that would become illegal.
>> Could you give a small example?
>> ...
>
>Neither Jim Adcock nor anybody else has tried to back his claim.
>Still no examples?
>

	On the 80x86 machines, with segmented architectures,
one might define == and != to comparte BOTH the offset and segment
(as required by the ARM and the extra rule you suggested ought to
have been in the ARM).

	However, the < operator might be implemented to compare
ONLY the offset part. This is legal because it is 'implementation
defined'. One could create TWO arrays in different segments,
and use < to compare relative positions of pointers into
these different arrays.

Such an implementation dependent routine would fail 
if the definition of < were
changed, including if it were changed to require a total order.

This is not a very practical example, Jim can provide a better one
perhaps. 
-- 
;----------------------------------------------------------------------
        JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
	Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------


