enums in C++

Matt Austern austern@sgi.com
Tue Apr 18 09:55:00 GMT 2000


Ulrich Drepper writes:

 > > Unless I'm missing something, only the name mangling is different, and
 > > that's something that happens well after overload resolution. (It's
 > > possible for a different calling convention too, but that also is after
 > > overload resolution.)
 > 
 > There are other things.  E.g.,
 > 
 > extern "C" {
 > struct foo
 > {
 > 	int foo;
 > };
 > }
 > 
 > must be possible.
 > 
 > > If I understand you correctly, you want an extension to C++.
 > 
 > No, I want special treatement for C functions.

But functions declared as extern "C" aren't C functions.  They're C++
functions that happen to use a C calling convention.  They obey the
C++ language rules in every way, and they may use C++ language
features freely.

The C++ standard does not provide a mechanism for compiling C code
within a C++ translation unit.

                        --Matt


More information about the Gcc-bugs mailing list