🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #2141

Function linkage name depends on enum parameter seen as C or C++

#2141
From: Brad Fowlow
Date: Mon, 08 Jan 1990 20:59
76 lines
2928 bytes
I'm not sure this is a bug but it hurts when it bites.

If an enum is seen under extern "C" it gets a different name
for function-parameter encoding than if the same enum is seen
by C++ directly.   

The following session demonstrates.  Note that the linkage name for 
'check' in the nm output at the bottom varies for a.cc and b.cc.

Script started on Mon Jan  8 15:46:14 1990
tsingtao.brad 1 % 
tsingtao.brad 1 % cat a.cc 
/*
 *  Version A - C linkage for enum
 */
extern "C" {
typedef enum { Stop, Go } E;
}

void check( E );

void test()
{
   check( Stop );
}

tsingtao.brad 2 % cat b.cc

/*
 *  Version B - C++ linkage for enum
 */

typedef enum { Stop, Go } E;

void check( E );

void test()
{
   check( Stop );
}

tsingtao.brad 3 % g++ -v -c a.cc b.cc
gcc version 1.36.1 (based on GCC 1.36)
 /usr/local/lib/gcc-cpp -+ -v -undef -D__GNUC__ -D__GNUG__ -D__cplusplus -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__HAVE_68881__ -Dmc68020 a.cc /usr/tmp/cca11478.cpp
GNU CPP version 1.36
 /usr/local/lib/gcc-cc1plus /usr/tmp/cca11478.cpp -quiet -dumpbase a.cc -version -o /usr/tmp/cca11478.s
GNU C++ version 1.36.1 (based on GCC 1.36) (68k, MIT syntax) compiled by GNU C version 1.36.
default target switches: -m68020 -mc68020 -m68881 -mbitfield
 /usr/local/lib/gcc-as -mc68020 -o a.o /usr/tmp/cca11478.s
 /usr/local/lib/gcc-cpp -+ -v -undef -D__GNUC__ -D__GNUG__ -D__cplusplus -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__HAVE_68881__ -Dmc68020 b.cc /usr/tmp/cca11478.cpp
GNU CPP version 1.36
 /usr/local/lib/gcc-cc1plus /usr/tmp/cca11478.cpp -quiet -dumpbase b.cc -version -o /usr/tmp/cca11478.s
GNU C++ version 1.36.1 (based on GCC 1.36) (68k, MIT syntax) compiled by GNU C version 1.36.
default target switches: -m68020 -mc68020 -m68881 -mbitfield
 /usr/local/lib/gcc-as -mc68020 -o b.o /usr/tmp/cca11478.s
tsingtao.brad 4 % nm a.o b.o

a.o:
         U _check__F3$_0
00000000 T _test__Fv
00000000 t gcc_compiled.

b.o:
         U _check__F1E
00000000 T _test__Fv
00000000 t gcc_compiled.
tsingtao.brad 5 % exit
tsingtao.brad 6 % 
script done on Mon Jan  8 15:47:58 1990

.................................................................
Brad Fowlow  bnrmtl!brad@larry.mcrcim.mcgill.edu
             .....................................................
             BNR              
	     3 Place du Commerce, Verdun, Quebec, Canada  H3E 1H6 
Technical Details
Message-ID: <9001082059.AA01438@bnrmtl.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!LARRY.MCRCIM.MCGILL.EDU!brad%bnrmtl.UUCP

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!LARRY.MCRCIM.MCGILL.EDU!brad%bnrmtl.UUCP
From: brad%bnrmtl.UUCP@LARRY.MCRCIM.MCGILL.EDU (Brad Fowlow)
Newsgroups: gnu.g++.bug
Subject: Function linkage name depends on enum parameter seen as C or C++
Message-ID: <9001082059.AA01438@bnrmtl.com>
Date: 8 Jan 90 20:59:51 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 76