This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Philip Prindeville <philipp_subx@redfish-solutions.com> 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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]