Bug with extern "C"

Lawrence Kesteloot lk@pdi.com
Tue Dec 8 21:07:00 GMT 1998


Hi!

I'm running Linux 2.0.35 with egcs:

gcc version egcs-2.91.57 19980901 (egcs-1.1 release)

If you have the following program:


    extern "C" {
    void empty_parens(void (*callback)());
    void void_parens(void (*callback)(void));
    }

    void
    empty_parens(void (*callback)())
    {
    }

    void
    void_parens(void (*callback)(void))
    {
    }

and run:

% g++ -c foo.c
% nm foo.o

you get:

    00000000 ? __FRAME_BEGIN__
    00000000 T empty_parens__FPFv_v
    00000000 t gcc2_compiled.
    0000000c T void_parens

Note that the declaration with () was name-mangled, whereas
the one with (void) was not.  If you extend the extern "C"
to the function definition, then both are C-style.  IRIX's
CC compiler makes both functions C-style, which I think is
the correct behavior.

Thanks,

Lawrence Kesteloot




More information about the Gcc-bugs mailing list