This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: extern "C" bug


From: Norbert O. Stoeffler <Norbert.O.Stoeffler@lpr.e-technik.tu-muenchen.de>
>/* The following code documents a bug or at least a very
> strange feature of the current versions of gcc-2.8 and egcs */
>
>extern "C" {
>
>/* according to C syntax the number of parameters to the following
>   function foo is not defined */

Sorry, you've misunderstood the way extern "C" is supposed to work. It
*only* affects linkage -- it tells the compiler "the following symbols
are to be presented to the linker using C conventions, not C++ ones"
(typically, this means switching off name mangling). It does *not*
have any effect on syntax. Code inside an extern "C" block is still
C++, not C.

>/* according to C syntax the number of parameters to the following
>   function foo is not defined */
>
>void foo();

But according to C++ this is a function with no parameters, and putting
it in an extern "C" block doesn't change this.

--
Ross Smith ................................... mailto:ross.s@ihug.co.nz
.............. The Internet Group, Auckland, New Zealand ..............
                               * * * * *
    To err is human. To really screw up requires the root password.




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]