[vtk-developers] C++ NULL definition (was: Request for a gentler tone in commit message verbiage...)

Robert Maynard robert.maynard at kitware.com
Thu Apr 30 10:41:33 EDT 2015


The base of the confusion is that the definition of what NULL
represents changed between C++98 and C++11. The original topic was
discussing issues with MSVC 2010 and above which are C++11 compilers,
and so in that regard we should be using the C++11 definition of NULL.
While the standard list that 0 and 0L as possible implementations, it
doesn't exclude things such as std::nullptr_t which are also valid.



On Thu, Apr 30, 2015 at 10:26 AM, Brad King <brad.king at kitware.com> wrote:
> On 04/30/2015 10:20 AM, Robert Maynard wrote:
>> Actually the definition of NULL is left up to each compiler. The C++11
>> draft states "The macro NULL < snip> is an implementation-defined C++
>> null pointer constant"
>
> C++98 18.1/4 says it is implementation defined but has a footnote
> that does not leave much room:
>
>  180) Possible definitions include 0 and 0L, but not (void*)0.
>
> The reason plain C's "((void*)0)" does not work in C++ is because
> C++ is strict about pointer conversions where C is tolerant.
>
> -Brad
>


More information about the vtk-developers mailing list