Date: Sat, 23 Aug 2025 17:10:31 +0200
On 23/08/2025 06:05, organicoman via Std-Proposals wrote:
>
>
>
>
> Sent from my Galaxy
(Please fix this if you can - use a better email program that handles
attributions and quotation indents correctly. It makes it a lot easier
to see who has written what.)
>
> On Fri, Aug 22, 2025 at 11:04 PM organicoman via Std-Proposals
> <std-proposals_at_[hidden]> wrote:
>> Does the standard mandate that dereferencing the null pointer is a
>> "guaranteed runtime error"? Because, last time I checked, it was
>> undefined behavior that's no different from dereferencing a pointer to
>> an object past its lifetime.
>>
>> So from the perspective of the standard, this would do absolutely
>> nothing different.
>
> Standard wise you are right, but OS wise it's a segfault, and that's
> more important.
>
Fortunately for a great many of the C++ users out there, what the
standards say is important, /not/ what particular OS's do. The majority
of "things running software" out there do not run an OS that has a
concept of "segfault" - the majority do not use an OS at all. C++ is
wider than just Windows and *nix.
And even on *nix or Windows, dereferencing a null pointer is in no way
guaranteed to give a segfault. Dereferencing a null pointer is
undefined behaviour, and can cause daemons to be launched from your
nose. /That/ is more important.
>
>
>
>
> Sent from my Galaxy
(Please fix this if you can - use a better email program that handles
attributions and quotation indents correctly. It makes it a lot easier
to see who has written what.)
>
> On Fri, Aug 22, 2025 at 11:04 PM organicoman via Std-Proposals
> <std-proposals_at_[hidden]> wrote:
>> Does the standard mandate that dereferencing the null pointer is a
>> "guaranteed runtime error"? Because, last time I checked, it was
>> undefined behavior that's no different from dereferencing a pointer to
>> an object past its lifetime.
>>
>> So from the perspective of the standard, this would do absolutely
>> nothing different.
>
> Standard wise you are right, but OS wise it's a segfault, and that's
> more important.
>
Fortunately for a great many of the C++ users out there, what the
standards say is important, /not/ what particular OS's do. The majority
of "things running software" out there do not run an OS that has a
concept of "segfault" - the majority do not use an OS at all. C++ is
wider than just Windows and *nix.
And even on *nix or Windows, dereferencing a null pointer is in no way
guaranteed to give a segfault. Dereferencing a null pointer is
undefined behaviour, and can cause daemons to be launched from your
nose. /That/ is more important.
Received on 2025-08-23 15:10:41