[quote name='Hodgman' timestamp='1355570648' post='5010908']
[font=courier new,courier,monospace]NULL[/font] is [font=courier new,courier,monospace]#define[/font]d as [font=courier new,courier,monospace]0[/font], meaning there's absolutely no difference except style/personal preference, and Bjarne "C++" Stroustrup was quoted earlier as preferring 0 (or nullptr in C++11 where available) over the NULL macro.
As far as I understand, C++ does not require NULL to be zero.
It can be any integer beside 0.
I can not remember where I read, but on some embed system, NULL can be a value different than zero.
So he is correct.
[/quote]
Not in a standard complying C++ implementation. The C++ standard requires [font=courier new,courier,monospace]NULL[/font] to evaluate to zero (that is, [font=courier new,courier,monospace]NULL[/font] == 0 is always true). Embedded systems implementations sometimes break the rules of C++, so they're not exactly the best reference. If you don't believe me, read the
C++ Standard:
Section 18.2, paragraph 3: The macro NULL is an implementation-de?ned C++ null pointer constant in this International Standard
Section 4.10, paragraph 1: A null pointer constant is an integral constant expression prvalue of integer type that evaluates to zero or a prvalue of type [font=courier new,courier,monospace]std::nullptr_t[/font]
Since [font=courier new,courier,monospace]NULL[/font] is required to be a "null pointer constant" and a "null pointer constant is an integral constant expression [...] that evaluates to zero" we can deduct that [font=courier new,courier,monospace]NULL[/font] evaluates to zero.