This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: extern "C" bug
- To: <egcs-bugs at cygnus dot com>
- Subject: Re: extern "C" bug
- From: "Ross Smith" <ross dot s at ihug dot co dot nz>
- Date: Fri, 12 Feb 1999 08:19:14 +1300
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.