function prototype problem

Don_A_Corbitt at cup.portal.com Don_A_Corbitt at cup.portal.com
Tue Nov 15 01:48:53 AEST 1988



>char *rpeet  ( short, char );
>char *rpeet ( num, ch)
> short num; char ch;
>--
>and get the following gripe from my compiler (gcc 1.30):
>
>rpeet.c: In function rpeet:
>rpeekkjt.c:9: argument `num' doesn't match function prototype
>rpeet.c:9: argument `ch' doesn't match function prototype
>
>Mark
>					tulsun!drd!mark at Sun.COM
>	DRD Corporation			mlawrence at jarsun1.ZONE1.COM
>	 (918)743-3013			drd!mark at apctrc.UU.NET
>					okstate!romed!drd!mark at rutgers.EDU
The problem is you are mixing declaration types.  Old style (K&R) automatically
promotes short/char to int.  New style (ANSI) lets you declare/pass shorts and
chars (although it is usually less efficient).  You should declare rpeet as
char *rpeet(short num, char ch) { ...
	Don Corbitt, CrystalGraphics, Inc.
	Don_A_Corbitt at cup.portal.com "The place with no .signature file"
	(This is my first posting, if it ends up in New Zealand and nowhere
	else, I'd appreciate mailed hints on what I shoulda done...:-)



More information about the Comp.lang.c mailing list