[ub] Justification for < not being a total order on pointers?

Nevin Liber nevin at eviloverlord.com
Fri Oct 11 01:08:38 CEST 2013


[Y'know, I really wish replies would by default go the whole ub group...]


On 10 October 2013 17:35, Gabriel Dos Reis <gdr at microsoft.com> wrote:

>  I don’t know because I don’t have access to all machines, nor did
> anybody ****
>
> came forward with that universal knowledge.****
>
> ** **
>
> I am seriously hoping that we would NOT claim ‘willful ignorance’ as basis
> for design.
>

I thought one of the design principles discussed today in another forum was
to make the language and library less expert-only.

The fact that pointers may not be totally ordered makes any comparison of
them in the realm of experts only.

If someone writes:

struct Foo
{
    X x;
    Y y;
    Z z;

    friend bool operator<(Foo const& l, Foo const& r)
    { return std::tie(l.x, l.y, l.z) < std::tie(r.x, r.y, r.z); }
};

If X, Y or Z are pointers, this code is broken!  And that is with tuple
being designed *by experts* with this use case in mind.  If the committee
can't handle it, what chance do mere mortals have?
-- 
 Nevin ":-)" Liber  <mailto:nevin at eviloverlord.com>  (847) 691-1404
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.open-std.org/pipermail/ub/attachments/20131010/bad48990/attachment.html 


More information about the ub mailing list