why #if defined(__cplusplus)

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

 



Hello,

As far as I know, the linux kernel cannot be compiled as a C++ source;
I remember that I saw some explanations on why it cannot be treated as a
C++ code in more than one place. (I don'r rememer the exact reasons; maybe one
of the.
for example. was that there is a variable called new?)


However,I saw some places where you'll find #if defined(__cplusplus).

For example, in include/linux/stddef.h , you have

#if defined(__cplusplus)
#define NULL 0
#else
#define NULL ((void *)0)
#endif

I wonder:
Why is this #ifdef exist at all if we know for sure that you can't compile the kernel as a C++ source code?



Regards, John

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/



-- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux