C++ Logo

sg12

Advanced search

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

From: Jens Maurer <Jens.Maurer_at_[hidden]>
Date: Thu, 10 Oct 2013 08:43:39 +0200
On 10/10/2013 08:21 AM, Lawrence Crowl wrote:
> The total ordering can be significantly more complex than today whenever
> two segments can refer to the same memory. In general, it may require
> an OS query to the virtual table to provide the ordering, which is likely to
> be way more expensive than anyone would like.

Why should < reflect such virtual memory hackery at all?

Note that comparing pointers to different complete objects yields
unspecified results anyway (see 5.9 expr.rel).

I don't think there is a way to tell C++ that I've got two pointers
that look like pointing to different objects (= different regions of
storage), yet are the same when looking through the VM layers.
Such a setup should cause all kinds of aliasing issues, where < is the
least of the problems.

Thanks,
Jens

Received on 2013-10-10 08:57:22