Issue 1053: Conversion of NULL to intptr_t or uintptr_t

Authors: Jay Ghiron
Date: 2026-05-06
Submitted against: C23
Status: Open

Before C23, the following program was always valid if intptr_t was defined:

#include<stddef.h>
#include<stdint.h>
int main(){
(intptr_t)NULL;
}

However, NULL is now allowed to be defined as nullptr which cannot be cast to an integer type. It seems unnecessary to forbid this, and C++ allows using nullptr in place of (void*)0 in pointer to integer conversions.

Suggested correction

Modify C23 6.5.5 paragraph 4:

The type nullptr_t shall not be converted to any floating type other than void, bool or a pointer type.

Note: The text seems to currently forbid (nullptr_t)nullptr despite the next sentence intending to allow it.

Replace C23 6.3.3.4:

A value of type nullptr_t can be converted to an integer type, the result is equivalent to converting (void*)0 to the same integer type. A value of type nullptr_t can be converted to a pointer type or nullptr_t, the result is a null pointer.

Note: The text currently says "The type nullptr_t can be converted ..." which is inconsistent with how other conversions are described on values rather than types.

Note: It seems unnecessary to define the conversion of nullptr_t to void here.