This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.
NULL
is too broadSection: 17.2.3 [support.types.nullptr] Status: New Submitter: Janet Cobb Opened: 2024-12-09 Last modified: 2024-12-21
Priority: Not Prioritized
View all issues with New status.
Discussion:
7.3.12 [conv.ptr]/1 reads in part: "A null pointer constant is an integer literal (5.13.2 [lex.icon])
with value zero or a prvalue of type std::nullptr_t
.".
NULL
is an implementation-defined null pointer constant.".
Together, these imply that #define NULL (::std::unreachable(), nullptr)
is a conforming definition. The expression is
a prvalue of type std::nullptr_t
, so it is a null pointer constant. This makes it implementation-defined whether
any program that evaluates NULL
has undefined behavior.
Proposed resolution:
This wording is relative to N5001.
Modify 17.2.3 [support.types.nullptr] as indicated:
-2- The macro
161) Possible definitions includeNULL
is an implementation-defined null pointer constant that is a literal (5.13.2 [lex.icon], 5.13.8 [lex.nullptr]).footnote 1610
and0L
, but not(void*)0
.