Re: Conflict of 'new' keyword when including C header files into C++ modules

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

 



Philip Prindeville <philipp_subx@xxxxxxxxxxxxxxxxxxxxx> writes:

> I was wondering why header files that are bracketed as:
>
> extern "C" {
> #include <linux/list.h>
> ...
> }
>
> still have a problem with this.  Do the C++ keywords still exist while in the "C" space?

Yes.  extern "C" only changes the external names used for functions and
global variables, such that they are compatible with the names generated
by a C compiler.  It does not change the actual language.  You can write
normal C++ code within an extern "C" block.

> What's the easiest work-around?

Fixing the code?

#define new avoid_cxx_new_keyword ?

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux