This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Conflict of 'new' keyword when including C header files into C++ modules
- From: Ian Lance Taylor <iant at google dot com>
- To: Philip Prindeville <philipp_subx at redfish-solutions dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Tue, 04 Jan 2011 18:00:10 -0800
- Subject: Re: Conflict of 'new' keyword when including C header files into C++ modules
- References: <4D23CD94.30503@redfish-solutions.com>
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