Re: [boost] null
by Eric Niebler other posts by this author
Jul 28 2005 6:22PM messages near this date
Re: [boost] null
|
Re: [boost] null
SOURCE 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
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Thread:
Jason Hise
Martin Wille
Jason Hise
Martin Wille
Eric Niebler
Eric Niebler
Jason Hise
|