Problem with using "pEdge==NULL"

John (Eljay) Love-Jensen eljay@adobe.com
Sun Sep 9 20:40:00 GMT 2007


> Since this is C++ you should not use NULL anyway.

I disagree with Stroustrup on the issue of whether or not to use NULL.  (His concern makes sense from the C days when some C compilers defined NULL to be ((void*)0), which is not desirable in C++, but most header files that define NULL are aware of C++-isms and why ((void*)0) is not desirable for C++.)

And NULL is in the C++ (ISO 14882) standard.

Although my druthers is that Stroustrup should have taken the opportunity to introduced 'null' or 'nil' or something akin as a new keyword proper, instead of as a macro.  Alas, he did not.

GCC defines NULL to __null, which is more typesafe than using 0.

--Eljay



More information about the Gcc-help mailing list