C++ Logo

STD-PROPOSALS

Advanced search

Subject: Re: [std-proposals] What happened on "Null safety" in p0946r0 about p <=> nullptr
From: Arthur O'Dwyer (arthur.j.odwyer_at_[hidden])
Date: 2019-12-05 07:16:43


On Thu, Dec 5, 2019, 6:13 AM Jake Arkinstall via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> Ah of course. I'm thinking of a comparison that demands two identical
> argument types, which isn't necessarily the case.
>
> Im just thinking from the memory model point of view. A nullptr is
> implicitly convertible to a fictional object at address 0. Valid pointers
> represent objects at address >0.
>

...or <0. I don't know what the default is these days, but I remember that
Intel x86 at least *used* to have signed pointers. That is,
(char*)0xffffffff would compare less than (char*)0x00000001, exactly the
same way that (int)0xffffffff compares less than (int)0x00000001.

I think it would be good to require pointer comparison to be a total order
consistent with std::less, but there is clearly a lot of influence on the
opposite side, or else the wording for std::less wouldn't be so complicated.

https://quuxplusone.github.io/blog/2019/01/20/std-less-nightmare/

Arthur



STD-PROPOSALS list run by std-proposals-owner@lists.isocpp.org

Standard Proposals Archives on Google Groups