Re: what is the use of extern "c"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 21 January 2013 15:17, Tim Prince wrote:
> On 1/20/2013 10:47 PM, horseriver wrote:
>>
>>
>>     what is the use of extern c within a declaration?
>>
>>
>>
> extern "C" basically shuts off C++ symbol mangling (and facilities which
> depend on it), so as to facilitate linking with C and with languages such as
> Fortran which support C interoperability.

And says to use C calling conventions, because there's no guarantee
C++ uses the same ones (though with GCC it does.)

>  The definition seems rather
> loose; we frequently see reference operators used even though their
> compatibility with C is doubtful.

That's perfectly well-defined. A C program would be able to link to
such a function and e.g. take its address. It just won't be able to
call it (correctly) because it can't pass it a reference.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux