C++ Logo

SG12

Advanced search

Subject: Re: [ub] Justification for < not being a total order on pointers?
From: Jens Maurer (Jens.Maurer_at_[hidden])
Date: 2013-10-10 01:43:39


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


SG12 list run by herb.sutter at gmail.com