Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2005-07-28 20:19:09


Eric Niebler wrote:
> Jason Hise wrote:
>
>>Martin Wille wrote:
>>
>>>Jason Hise wrote:
>>>
>>>>undef NULL
>>>>#define NULL (::boost::null)
>>>>
>>
>>What existing code will it break?
>
>
> struct foo {};
> typedef void (foo::*memfunptr)();
> memfunptr p = NULL;

Bad example. This is OK, somewhat surprisingly (to me, at least). But
consider:

struct foo { foo(void*) {} };
void bar(foo f) {}
void baz() {
   bar(NULL);
}

Works with NULL as 0, fails with NULL as null because it needs two
user-defined conversions.

> Redefining NULL is a career-limiting move. Don't do it.

This is still correct, though.

-- 
Eric Niebler
Boost Consulting
www.boost-consulting.com

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