From 4606287450381795620
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,e94695845965b249
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1992-11-27 05:15:56 PST
Newsgroups: comp.std.c++
Path: sparky!uunet!mcsun!news.funet.fi!network.jyu.fi!sakkinen
From: sakkinen@jyu.fi (Markku Sakkinen)
Subject: Re: Zero-length structures and pointer comparisons
Message-ID: <1992Nov27.091056.3895@jyu.fi>
Organization: University of Jyvaskyla, Finland
References: <1992Nov4.080805.13496@jyu.fi>
Date: Fri, 27 Nov 1992 09:10:56 GMT
Lines: 60

I wrote some weeks ago:
> In article <1992Oct30.003946.10484@microsoft.com> jimad@microsoft.com (Jim Adcock) writes:
> >In article <1992Oct28.184135.25475@ucc.su.OZ.AU> maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
> >|	...
> >|If a total ordering was required, programs utilising
> >|this requirement would be portable. 
> >
> >Nope.  They would only become portable if this was the last non-portability
> >in that program -- hardly likely.
> >
> >On the converse side, tons of previously legal but not *strictly* portable 
> >programs would now become illegal.
> >
> >Thus your trade-off would represent a major lose:  Lots of legal programs
> >become busted in exchange for making an unlikely few programs portable.
> > ...
> 
> I would first like to return to a much more important, related problem,
> which somebody brought up here rather recently.
> Namely, there is nothing in the ARM explicitly saying that
> p == q  might not yield 1 even when p and q are pointing at two different
> objects.  This hole makes e.g. some standard idioms in Stroustrup's books
> implementation dependent.
> ...

Steve Clamage replied to this part in his usual, nice and informative manner.
Essentially, in ANSI C pointers at two different objects are required
to compare inequal, and the C++ committee may add the same rule.

> Suppose that the above problem is settled (alt. 1 or 2).
> 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?

----------------------------------------------------------------------
Markku Sakkinen (sakkinen@jytko.jyu.fi)
       SAKKINEN@FINJYU.bitnet (alternative network address)
Department of Computer Science and Information Systems
University of Jyvaskyla (a's with umlauts)
PL 35
SF-40351 Jyvaskyla (umlauts again)
Finland
----------------------------------------------------------------------


