Skip to content

NULL

Tuesday, 22 November 2005  |  lubos lunak

From the KOrganizer coding style guidelines: "A null pointer is 0, not 0l, 0L or NULL. Once again, this is C++, not C." Hmmm. If you get bored sometimes, try to compile with gcc something like "void foo( int ); ... foo( NULL );" and see what happens. And then what happens with "foo( 0 );" (and yes, I remember fixing a bug in KDE caused by this). Ok, NULL is not what it really should be, but C/C++ have many small weird things (ever wondered why binary operators | and & have so stupid priority? It's called backwards compatibility lasting for more than 30 years). Moreover, I wonder, why are symbolic constants C but not C++?