I've got C++ functions that I want to declare using extern "C" even though they are only called in C++ code. Yes, I know this is strange but it's something I would like to do for consistency since we have mixed C and C++ declarations. I just want to make sure that declaring a C++ function as extern "C" won't affect the behavior of throwing.
It would look something like this:
extern "C" void foo() {throw exception;}
int bar()
{
try
{
foo();
} catch (exception e) { return 1; }
}
extern "C"functions from C++ or from C? If you're calling them from C++ (and never from C), there's the inevitable question "why are the functionsextern "C"if they're never called from another language?", but I think that simply calling C++ functions withextern "C"from C++ means there is no language boundary crossed and therefore no undefined behaviour./EHscsays otherwise.