C++ Logo

std-proposals

Advanced search

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

From: Thiago Macieira <thiago_at_[hidden]>
Date: Fri, 25 Jul 2025 12:29:25 -0700
On Friday, 25 July 2025 04:17:32 Pacific Daylight Time Frederick Virchanza
Gotham via Std-Proposals wrote:
> This is the reason why I think "nullptr" and "badptr" should be far
> away from each other -- it's not good enough to be able to
> increment/decrement one of them to get the other.

The furthest you can get on Linux is ±4096: 0xfffff000 on 32-bit architectures.
Other values are architecturally allowable.

In any case, I don't think we need this in the Standard. That sounds more like
a compiler option, especially because the compiler might realise you're making
a dead store and eliminate it otherwise.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel Platform & System Engineering

Received on 2025-07-25 19:29:28