function prototype problem
Joseph Nathan Hall
jnh at ece-csc.UUCP
Tue Nov 15 23:59:28 AEST 1988
In article <8889 at smoke.BRL.MIL> gwyn at brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>) writes:
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).
Not only does VAX (VMS) C diagnose this, it prohibits it.
--
v v sssss|| joseph hall || 201-1D Hampton Lee Court
v v s s || jnh at ece-csc.ncsu.edu (Internet) || Cary, NC 27511
v sss || the opinions expressed herein are not necessarily those of my
-----------|| employer, north carolina state university . . . . . . . . . . .
More information about the Comp.lang.c
mailing list