Boost logo

Boost Users :

From: Marc Horowitz (marc_at_[hidden])
Date: 2008-06-16 14:00:47

Jens Seidel <jensseidel_at_[hidden]> writes:

>> Right, null_ptr will be part of C++. Nevertheless NULL was never part of
>> C++! g++ defines it for convenience, the Intel compiler does not.

Perhaps boost should provide it, if the compiler doesn't?

>> It is often defined by 3rd libraries. glib uses:
>> #ifndef NULL
>> # ifdef __cplusplus
>> # define NULL (0L)
>> # else /* !__cplusplus */
>> # define NULL ((void*) 0)
>> # endif /* !__cplusplus */
>> #endif
>> /usr/include/linux/stddef.h is similar but uses 0 instead of 0L in C++
>> mode.
>> Nevertheless even with nullptr as defined as in
>> I wasn't able to let the Intel compiler warning
>> warning #1881: argument must be a constant null pointer value
>> vanish. The code I used is:
>> XtVaCreateManagedWidget("widget_name", xmFrameWidgetClass, form, NULL);
>> (where I replaced NULL by nullptr, ...)
>> So don't rely on NULL. It's evil ...
>> null_ptr doesn't help in all cases as well :-)

Well, the actual environment here is some COM methods under msvc. C++
may not specify NULL, but the COM interface docs specify the use of it
all over the place, which leaves me little choice.

If this means you want to add COM to the evil list, I won't object :-)


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at