Boost logo

Boost Users :

Subject: Re: [Boost-users] [test] BOOST_CHECK_EQUAL comparisons with NULL don't compile
From: Richard (legalize+jeeves_at_[hidden])
Date: 2012-09-13 02:37:53


[Please do not mail me a copy of your followup]

boost-users_at_[hidden] spake the secret code
<CANoJS9q8C8+1vVyPhPoiqdYPJsWwP7xHoWUNf8XMr6Qb7mbdZA_at_[hidden]> thusly:

> BOOST_CHECK_EQUAL(ptr, NULL);

BOOST_CHECK(!ptr);

But in general, yes, NULL is problematic for a number of reasons and
that is why C++11 introduced the nullptr keyword. C++ prior to that
had advocated the use of the constant 0 instead of NULL (NULL was,
after all, a C-ism that C++ inherited), but in certain template
constructs even that wasn't distinguishing enough between "the pointer
to nothing" and "integer constant".

-- 
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
     The Computer Graphics Museum <http://computergraphicsmuseum.org>
         The Terminals Wiki <http://terminals.classiccmp.org>
  Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net