Re: ?? warning: ANSI C++ forbids implicit conversion from `void * ' in initialization ???



>It is always better to use macros for portability reasons. A single #define

this is nonsense. there has only ever been one meaning of a null
pointer. the fact that certain projects have mis-defined it from the
perspective of a C++ programmer doesn't change that.

assuming that the macro is correctly defined, there is absolutely no
difference in any way between writing

      ptr = NULL;
and
      ptr = 0;

if the compiler does not support the standard for null pointer
conversion (i.e. an integer value of 0 will converted to a null
pointer), there is no possible definition of NULL that will work, so
the macro isn't buying you anything.

if you happen to be a person who likes to look for "NULL" in code
because you think it provides some kind of semantic guidance, feel
free to use "NULL". i'm not one of those people.

--p



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]