On Fri, May 11, 2018 at 03:03:09PM +0300, Alexander Monakov wrote:
> On Fri, 11 May 2018, Segher Boessenkool wrote:
> > > In general such address-based comparisons steps are invalid; they lack
> > > anti-reflexivity. So comparators are not actually allowed to do that.
> > 
> > I don't know what you mean here?  Every comparator is required to be
> > *reflexive*!  Subtracting two pointers to elements of the same array gives
> > a perfectly fine total order as far as I see (it is the same as the
> > difference between the array indices of those elements).
> 
> I meant "anti-commutativity"; sorry about the mixup. Such strategy does not
> give a valid total order because the order changes while in-progress sorting
> reorders elements:

Ah.  Right.  C11 7.22.5/4.  Sorry for being dense, I'll drink more coffee.


Segher

Reply via email to