
Martin Wille wrote:
Jason Hise wrote:
I plan to sneak an improved version of the null developed by Scott Meyers in with this code in a header called boost/null.hpp, and use it in the singleton's implementation. It will be defined as follows:
[...]
undef NULL #define NULL (::boost::null)
I violently object to sneaking in something that fundamental.
If I was really trying to 'sneak' it in I wouldn't have mentioned it explicitly on the list. ;)
I also object to this idea in general. It doesn't buy us much, it breaks existing code, it may cause ODR violations, and it also violates the C++ Standard.
What existing code will it break? I would imagine it would only break code that deserves to be broken in the first place (like int i = NULL). Also, how would this cause ODR violations? I was under the impression that the one definition rule required all definitions in different translation units to be identical, not that it required that a definition only be provided in one translation unit. And even if somehow more than one instance of null ended up being used, how would this actually end up causing a problem? Would your problem with this code vanish if I removed the NULL definition on the last two lines? Would it reappear if I moved the null class into the global namespace (essentially making lowercase null a keyword)? Please don't take my response as confrontational, I do appreciate the feedback. -Jason