C++ Logo

std-proposals

Advanced search

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

From: Sebastian Wittmeier <wittmeier_at_[hidden]>
Date: Sun, 3 Aug 2025 17:32:40 +0200
That could be a safety profile. But it would slow down any use of pointers. What if the compiler can prove that a pointer is no nullptr? E.g. if the same pointer is repeatedly dereferenced? Or proof, if otherwise UB would happen?   -----Ursprüngliche Nachricht----- Von:Frederick Virchanza Gotham via Std-Proposals <std-proposals_at_[hidden]> Gesendet:So 03.08.2025 16:48 Betreff:Re: [std-proposals] Standardising 0xdeadbeef for pointers An:std-proposals <std-proposals_at_[hidden]>; CC:Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>;   I'm going off on a tangent here, but imagine if we could mark a function (or lambda) as follows:     int Func(double) throw_on_nullptr    {         .  .  .    }  If you try to dereference a nullptr in this function, or if you perform addition or subtraction on a nullptr, it throws std::nullptr_t.  Maybe?    -- Std-Proposals mailing list Std-Proposals_at_[hidden] https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2025-08-03 15:42:51