Page 1 of 1

CRT design bug?

Posted: Sat Jun 07, 2008 5:45 am
by scorpion007
In the CRT article, you define NULL as follows:

Code: Select all

#ifdef __cplusplus
extern "C"
{
#endif

/* standard NULL declaration */
#define	NULL	0 // <- This happens unconditionally!

#ifdef __cplusplus
}
#else

/* standard NULL declaration */
#define NULL	(void*)0

#endif
If I'm not mistaken, you define NULL twice in C mode.

I would have expected it to be more like:

Code: Select all

#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void*)0)
#endif
Plain and simple. Also, no need to wrap it in extern "C" as there aren't any symbols being declared.