According to C++17 [basic.compound]/3:
Every value of pointer type is one of the following:
- a pointer to an object or function (the pointer is said to point to the object or function), or
- a pointer past the end of an object (8.7), or
- the null pointer value (7.11) for that type, or
- an invalid pointer value.
The malloc
function returns a pointer value. Let us assume the call succeeded, so that the return value is not null. The specification of malloc
([c.malloc]) does not state that it creates any objects in the returned storage, so it seems like "invalid pointer value" is the least nonsensical category.