Boost logo

Boost :

From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2022-05-30 00:11:42


On Sun, May 29, 2022 at 4:39 PM Andrey Semashev via Boost <
boost_at_[hidden]> wrote:
>
> On 5/30/22 02:22, Gavin Lambert via Boost wrote:
> > On 27/05/2022 23:00, Andrey Semashev wrote:
> >> It *is* a useless warning. The code with NULL is explicit enough and
> >> portable, so what is this warning about? That the code is not
> >> C++11-only? I know that, and it's not up to the compiler to tell me
that.
> >
> > The problem is that NULL is defined as a plain 0...
>
> This is an implementation detail. It could be __builtin_null(), which
> would behave equivalent to 0 or (void*)0 but would not emit warnings.

In C++ it is not allowed for NULL to be of type void* (it is allowed in C).

It could be some __null thing, but it has to behave the same as 0, except
maybe generate appropriate warnings. I've seen NULL defined as 0 or 0L,
which means overload resolution and thus portability is affected. Best to
avoid it in C++.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk