I know it is debatable and I could be convinced otherwise, but I would suggest:
#ifdef __cplusplus
extern "C" {
#endif
...
#ifdef __cplusplus
} /* extern "C" */
#endif
be applied liberally in gcc.
Not "around" #includes, it is the job of each .h file, and mindful of #ifdefs
(ie: correctly).
Rationale:
Any folks that get to see the mangled names, debugging, working on binutils,
whatever, are saved from them.
They are generally believed to be ugly, right? Yeah yeah, not a technical
argument.
For some reason, I wasn't able to set breakpoints in gdb on MacOSX otherwise,
though this doesn't make sense and a small example didn't reproduce the
behavior. I have since applied this to 300+ files in a 4.5.1 fork -- not all of
them just out of time/laziness. (I tried and failed to automate it.)
I think it is a good idea for any C or historically C code when moving to a C++
compiler.
I have done that with a few small/medium sized code bases.
They could/would be removed as templates/function overloads/operator
overloading are introduced.
Or such sections of code/declarations could have extern "C++" { } around them
(not a well known feature, but ok.)
- Jay