(* func)(fred, bert)

Karl Heuer karl at haddock.ima.isc.com
Tue Nov 28 10:00:55 AEST 1989


In article <30324 at iuvax.cs.indiana.edu> bobmon at iuvax.cs.indiana.edu (RAMontante) writes:
>Maybe stdlib.h or something should've included a standard prototype:
>	int main(int, char **, char **);
>to clean up stuff like this.

Firstly, the third argument to |main()| is not standard.

Secondly, such a prototype would cause a wrong-argument warning if the actual
definition of |main()| omits the arguments.  (The Committee *did* bless this,
making |main| a very special case in that it has *two* non-equivalent, valid
prototypes.)

The proper way to detect this error is for a High-Quality Implementation to
special-case it in the compiler, so that either |int main(int, char **)| or
|int main(void)| will be accepted.  (Of course, if the compiler also wants to
accept |int main(int, char **, char **)| or any of these with a |void| return
value, that would be a perfectly valid extension.)

Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint



More information about the Comp.lang.c mailing list