Date: Thu, 31 Jul 2025 17:06:56 +0200
One could define a possibly inlined standard function: Is pointer definitely invalid, which does not give a guarantee that it is valid, but possibly catches more than nullptr.
No need to start with page sizes.
The coverage of this function could be QoI and for simple systems, it could just return false (not definitely invalid) or just compare to nullptr.
-----Ursprüngliche Nachricht-----
Von:zxuiji via Std-Proposals <std-proposals_at_[hidden]>
Gesendet:Do 31.07.2025 17:09
Betreff:Re: [std-proposals] Standardising 0xdeadbeef for pointers
An:Thiago Macieira <thiago_at_[hidden]>;
CC:zxuiji <gb2985_at_[hidden]>; std-proposals_at_[hidden];
It's useful to know a standard range to apply. For example libraries like boost could detect if pointers passed to them are in said range and catch the problem before a segfault can happen. They can in turn exit the thread but not the whole app/game/etc.
On Thu, 31 Jul 2025 at 16:05, Thiago Macieira <thiago_at_[hidden] <mailto:thiago_at_[hidden]> > wrote:
On Thursday, 31 July 2025 08:08:51 Pacific Daylight Time zxuiji wrote:
> So we're designing for lala land where any and all silly systems exist are
> we? Just define a minimum based on real world standards which as far as I'm
> aware is 512 minimum which is reasonable enough for a `MIN_PAGE_SIZE 512`
> macro and certainly reasonable for a `MAX_INVALID_ADDRESS ((void*)512)`
> macro
Why do we need to change anything? What's the motivation?
We know that effectively the first and last pages are unavailable for any
system. So if you need to do some pointer math and know they are invalid, you
can.
But why does the *standard* need that?
--
Thiago Macieira - thiago (AT) macieira.info <http://macieira.info> - thiago (AT) kde.org <http://kde.org>
Principal Engineer - Intel Platform & System Engineering
--
Std-Proposals mailing list
Std-Proposals_at_[hidden]
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
Received on 2025-07-31 15:16:59