I remember one early version of a C++ compiler which had NULL #defined as (( void* )0), which caused all manner of fun trying to compile some legacy C code.
This was in 1999, I think.
This was in 1999, I think.
#define NULL __DARWIN_NULL
...
#define __DARWIN_NULL ((void *)0)
int *ptr = NULL; #ifdef __cplusplus
#define __DARWIN_NULL __null
#else /* ! __cplusplus */
#define __DARWIN_NULL ((void *)0)
#endif /* __cplusplus */
So the code you mentioned works just fine in C++.