Article View: gnu.gcc.bug
Article #2734Strange interaction between prototypes and typedefs
From: Steve Simmons
Date: Tue, 06 Jun 1989 03:55
Date: Tue, 06 Jun 1989 03:55
40 lines
1628 bytes
1628 bytes
I dunno if this is a bug in gcc or just my misunderstanding of how
prototypes work. The following program, odd.c, does not compile with
gcc version 1.34 on the UNIX-PC:
------------------------- start odd.c ---------------------------------
typedef char deftype ;
extern void function( deftype ) ;
#ifdef SHOW_ODD
void function( b )
deftype b ;
#else
void function( deftype b )
#endif
{
(void) printf( "function called.\n" ) ;
}
main()
{
deftype parameter = 'i' ;
function( parameter ) ;
}
------------------------- start odd.c ---------------------------------
Trying the compile with `gcc -DSHOW_ODD odd.c' gives the error messages:
odd.c: In function function:
odd.c:11: argument `b' doesn't match function prototype
odd.c:11: a formal parameter type that promotes to `int'
odd.c:11: can match only `int' in the prototype
Do the same without the -DSHOW_ODD switch and it compiles OK.
--
: "Coprophilia is not a disease or an abberation. It is a legitimate :
: alternative lifestyle." :
: "Hey Phil -- what's for lunch?" -- from "Clonezone" by Mike Baron :
Steve Simmons ...sharkey!lokkur!scs scs@lokkur.dexter.mi.us
Technical Details
Message-ID:
<1704@lokkur.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!umich!sharkey!oxtrap!lokkur!scsShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!umich!sharkey!oxtrap!lokkur!scs From: scs@lokkur.UUCP (Steve Simmons) Newsgroups: gnu.gcc.bug Subject: Strange interaction between prototypes and typedefs Message-ID: <1704@lokkur.UUCP> Date: 6 Jun 89 03:55:14 GMT Reply-To: scs@lokkur.dexter.mi.us (Steve Simmons) Distribution: gnu Organization: Inland Sea Software, Ltd. Lines: 40