I know that in our modern world NULL and 0 are not best practices in operating with pointers, and according to cppreference:
Pointer conversions A null pointer constant (see NULL), can be converted to any pointer type, and the result is the null pointer value of that type. Such conversion (known as null pointer conversion) is allowed to convert to a cv-qualified type as a single conversion, that is, it's not considered a combination of numeric and qualifying conversions.
But why this code is not allowed and gcc with clang give me an error?
A* foo()
{
return (bar(), NULL);
}
error: invalid conversion from long int to A*