This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
extern "C" bug
- To: egcs-bugs at cygnus dot com
- Subject: extern "C" bug
- From: "Norbert O. Stoeffler" <Norbert dot O dot Stoeffler at lpr dot e-technik dot tu-muenchen dot de>
- Date: Thu, 11 Feb 1999 15:12:35 +0100 (MET)
/* 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 */
void foo();
/* now we declare two function pointers, one global ... */
void (*bar)();
/* ... and one member of a structure with the same signature */
struct foo {
void (*bar)();
};
} // end of the extern "C" section
int main()
{
// this call to "foo" conforms to the declartion
foo(42);
// the same is true for the call via function pointer "bar"
bar(42);
// but why is the pointer treated differently when part of a structure?????
struct foo f;
f.bar(42); /* -> leads to an ERROR message:
ernie_$ egcc ttt.C
ttt.C: In function `int main()':
ttt.C:35: too many arguments to function
ernie_$ egcc --version
egcs-2.91.60
*/
}
/*
It would be very helpful to me, to know if you consider this behaviour
as a bug and if it's going to be fixed sometimes. In practice it
complicates interfacing with old code, e.g. the RPC communication
mechanism. Thanks in advance.
Gruss Norbert Stöffler
____________________________________________________________________
Norbert O. Stoeffler, LPR, Technische Universitaet, D-80290 Muenchen
tel +49 89 289-23565 fax-23555 http://www.lpr.ei.tum.de/~stoffler/
*/