Path: utzoo!attcan!uunet!sco!seanf From: seanf@sco.COM (Sean Fagan) Newsgroups: comp.lang.c Subject: Re: function prototype problem Message-ID: <1704@scolex> Date: 13 Nov 88 22:55:13 GMT References: <310@drd.UUCP> Reply-To: seanf@sco.COM (Sean Fagan) Distribution: na Organization: The Santa Cruz Operation, Inc. Lines: 31 In article <310@drd.UUCP> mark@drd.UUCP () writes: [about the gcc problem with:] >char *rpeet ( short, char ); >char *rpeet ( num, ch ) > short num; > char ch; [where gcc will complain about num beind redeclared as an int] gcc is behaving as if you had done a new-style declaration (since you can have the 'int' as optional, you can declare 'int main(ac, char **av)'), but had also predeclared it with a prototype. I personally think that gcc is wrong in this respect, but haven't had enough time lately to fix it. The problem is that gcc "does not have infinite lookahead." Stallman maintains that ANSI says to expand the arguments to match the prototype, and you are declaring rpeet (in the second one) as having to arguments of type int. 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. Does anybody who knows the ANSI draft agree with me (Chris? Dough? Dennis?). BTW, K&Rr2 warns about mixing old-style and new-style declarations; it seems to be a good idea 8-). -- Sean Eric Fagan | "Engineering without management is *ART*" seanf@sco.UUCP | Jeff Johnson (jeffj@sco) (408) 458-1422 | Any opinions expressed are my own, not my employers'.