function prototype problem

Doug Gwyn gwyn at smoke.BRL.MIL
Tue Nov 15 07:24:37 AEST 1988


In article <1704 at scolex> seanf at sco.COM (Sean Fagan) writes:
-In article <310 at drd.UUCP> mark at drd.UUCP () writes:
->char *rpeet  ( short, char );
->char *rpeet ( num, ch )
->    short num;
->    char ch;
-I, however, maintain what what ANSI says is that, if you declare a function
-using old-style declaration (as you did), then you do not expand the
-arguments unless a prototype is given; but if you use newstyle declarations
-(char *rpeet ( short num, char ch) {), everything is as if you had also
-given a prototype.

I don't have the draft Standard at hand right now, but I'm pretty sure
Stallman is right to have gcc diagnose this.  Old-style function syntax
requires widened arguments but the prototype indicates unwidened.  This
is clearly a type clash.  It is possible that the draft Standard really
says that a compiler has to straighten things out in cases like this
example, but I would find it surprising (and dangerous).



More information about the Comp.lang.c mailing list