extern c in cpp file`

Nathan Sidwell nathan@codesourcery.com
Fri Nov 28 16:51:00 GMT 2003


Eljay Love-Jensen wrote:
> Hi Yamin,
> 
> The  consequences of declaring a function as extern "C" are...
> 
> 1) the name will be mangled according to your platform's C mangling convention*.
> 2) I recall (and I may be mistaken) that such a function acts as a "C barrier", and thus exceptions do not propagate through such a function.
you are mistaken. when compiled by a C++ compiler, you'll get all the C++
exception semantics. When compiled by a C compiler, you might or might not
get unwind info emitted (with gcc -fexceptions, you will IIRC).

nathan

-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
          The voices in my head said this was stupid too
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk




More information about the Gcc-help mailing list