
On 04/13/2011 10:40 AM, Dave Abrahams wrote:
On Wed, Apr 13, 2011 at 1:32 PM, Anders Dalvander<boost@dalvander.com> wrote:
On 20:59, Nevin Liber wrote:
While the undefined behavior goes away, all that std::less guarantees is a total ordering for pointers. It doesn't specify what that ordering actually is.
True, the actual order isn't defined. But I don't see the issue.
Externally a contiguous memory block would be seen as a singleton and comparing it using std::less to any other contiguous memory block would result in either true or false.
The issue is that if you test an address for being within a given memory block, you can get false positives.
Oh, and to make things worse, IIRC there's nothing that says a< b == std::less<...>()(a,b) even within a given block, e.g. std::less<>()(a,b) could be implemented as a> b! So you can get false negatives, too.
Perhaps the real question is whether there exists a C++ compiler that we care about this working on that doesn't behave as we'd like. Not everything left undefined by the standard was necessarily a good decision.