C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Standardising 0xdeadbeef for pointers

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Thu, 31 Jul 2025 11:18:01 -0400
On Thu, Jul 31, 2025 at 11:09 AM zxuiji via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> 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.

And if the pointer is offset so far that it leaves this "bad range",
then it won't catch anything.

I don't really see the advantage of enforcing highly-platform specific
elements of memory architecture just for this possibility. The
cost/benefit just doesn't add up.

And that of course is ignoring the OP's specific desire to use such
"bad pointers" in an object's destructor, thus requiring the standard
to actually standardize the behavior of accessing an object's data
past the lifetime of that object.

Received on 2025-07-31 15:18:15