Using ’0’ instead of ’NULL’
-
0 is always 0, it can never be redefined as anything else.
-
In C, NULL is preferred because depending on the system, it might not be defined as 0 (but I've never seen an example of this). In C++, NULL is defined as 0 in the standard, so both are safely interchangeable. Some people still like using NULL because in their opinion it makes the code clearer. As previous posters have said, it's up to the coder.
-
-
"good article":http://mina86.com/2010/10/24/0-is-ambiguous/ about 0/NULL (and nullptr) in C/C++
-
There are a lot of companies banning the use of defines and macros just because of the possible risk of breaking a lot of stuff by changing just one define/macro. Since NULL is no more than 0 and not (void*)0 as it sometimes is in C, and it therefore will not generate compiler errors when used inappropriately, I see little value in typing it out.
-
-
[quote author="maciek" date="1291899880"]"good article":http://mina86.com/2010/10/24/0-is-ambiguous/ about 0/NULL (and nullptr) in C/C++[/quote] Thanks for the tipp, was interesting to read.