
29 Jul
2005
29 Jul
'05
1:19 a.m.
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