"Andy" <gn***@yahoo.com> wrote...
This is just a simple hello world program.
#include <iostream>
using namespace std;
int main()
{
cout<<"Hello,world\n";
}
Today I happened to look into the intermediate code genernated by
preprocessor. I found there is code like the follows:
extern "C++"{
....
}
Why we need such code? I am using gcc-3.4.2.
The only thing I can think of is that the module where you found that
construct is in fact a C module, not a C++ module, like the result of
the front-end (translator) work, which creates C code from C++ code for
the C compiler to digest and convert to object code. I don't know if
gcc uses that approach, but I know that Comeau C++ does, for example.
The language specification ("C++") in the 'extern' declaration is the
default for a C++ compiler, and explicit mentioning it probably makes no
difference in a C++ program.
V