tuecke@TROILUS.ACC.STOLAF.EDU (Steve Tuecke) (05/14/89)
/* Function prototyping for shorts and for floats is giving me problems. The following is compiled with gcc-1.35 on a Sun 3/160 running SunOS 4.0.1 */ void f1(short a1); void f2(float a2); main() { short a1 = 1; float a2 = 1.0; f1(a1); f2(a2); } void f1(a1) short a1; { } void f2(a2) float a2; { } /* This is the output from gcc: % gcc proto_bug.c proto_bug.c: In function f1: proto_bug.c:20: argument `a1' doesn't match function prototype proto_bug.c:20: a formal parameter type that promotes to `int' proto_bug.c:20: can match only `int' in the prototype proto_bug.c: In function f2: proto_bug.c:25: argument `a2' doesn't match function prototype proto_bug.c:25: a formal parameter type that promotes to `double' proto_bug.c:25: can match only `double' in the prototype I know that I could (should?) also declare my functions like: void f1(short a1) { } void f2(float a2) { } gcc compiles it fine with these function declarations. However, I'd like to keep my code compilable by cc which won't take function declarations of this type. (All my function prototypes are in a single header file, so a simple sed script which strips the argument prototypings makes it cc'able -- as long as the function declarations are in classic C form.) Steve Tuecke tuecke@mcs.anl.gov or tuecke@thor.acc.stolaf.edu */