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@lists.isocpp.org>
Gesendet: So 03.08.2025 16:48
Betreff: Re: [std-proposals] Standardising 0xdeadbeef for pointers
An: std-proposals <std-proposals@lists.isocpp.org>;
CC: Frederick Virchanza Gotham <cauldwell.thomas@gmail.com>;
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@lists.isocpp.org https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals