Problem with using "pEdge==NULL"

Erik sigra@home.se
Sun Sep 9 16:48:00 GMT 2007


Jeffrey Holle skrev:
> I'm creating an application that attempted to employ the statement:
>   if(m_future.getEdges().second!=NULL)
Since this is C++ you should not use NULL anyway. so the above code
should be
  if (m_future.getEdges().second)

(See the book by Bjarne Stroustrup, the creator of C++, "The C++
Programming Language", published in year 2000: quote from page 88:
"In C, it has been popular to define a macro NULL to represent the zero
pointer. Because of C++'s tighter type checking, the use of plain 0,
rather than any suggested NULL macro, leads to fewer problems." At page
433, he calls the NULL macro "infamous".)



More information about the Gcc-help mailing list