Title
Is `NULL` allowed to be expanded to an extension?
Status
new
Section
[support.types.nullptr]
Submitter
Jiang An

Created on 2026-09-14.00:00:00 last changed 1 week ago

Messages

Date: 2026-09-14.00:00:00

In some current implementations (e.g., in GCC and Clang's own <stddef.h> header), the `NULL` macro may be expanded to the `__null` extension (demo). Although `__null` can be used interchangeably with zero-value integer literals of the same type in most contexts, its exact spelling is observable.

LWG 4182 requires `NULL` to be expanded to a literal, and a pedantic reading may suggest that only standard literals are permitted. In other words, if a program requires `NULL` to be expanded as a standard literal (in either compile time or runtime), LWG 4182 seemingly requires implementations to support it, which in turns renders the existing use of the `__null` extension non-conforming.

History
Date User Action Args
2026-09-14 00:00:00admincreate