NULL vs 0

2010-09-21 Thread Alex Rousskov
On 09/20/2010 11:24 PM, Amos Jeffries wrote: On Mon, 20 Sep 2010 17:44:17 -0600, Alex Rousskov wrote: It is best to use 0 in C++ programs, but we have too much NULL-using code to fight. Easy enough to fix with a grep/sed. Do we make '0' a coding style requirement? Yes, we should if there

Re: NULL vs 0

2010-09-21 Thread Robert Collins
that, they also translate the if expression appropriately. But they are also meant to handle NULL vs 0 transparently in that case, AIUI. -Rob

Re: NULL vs 0

2010-09-21 Thread Alex Rousskov
(); if (!some_pointer) ... When compilers do that, they also translate the if expression appropriately. But they are also meant to handle NULL vs 0 transparently in that case, AIUI. Scary but good to know, thank you. Looks like 0xCDCDCDCD, if used as a pointer, becomes false in that case! Alex.