ANSI C prototypes
Richard Caley
rjc at uk.ac.ed.cstr
Tue Nov 6 12:51:28 AEST 1990
In article <3933.27353319 at cc.helsinki.fi> jaakola at cc.helsinki.fi writes:
It's okay for me to make an include file, where I declare functions that
are visible to other modules. But consider the following example:
static void auxiliary_func(a) /* private helper-function */
int a;
{
...
}
void visible_fun(b)
int b;
{
...
auxiliary_func(b+1); /* should be checked */
...
}
The point is, why should I have to tell the compiler twice the type of
auxiliary_func?
You don't. In the above case you havn't even told it once. If you
did...
static void auxiliary_func(int a)
{
...
}
you wouldn't need to type anything more. Or if you did that would be a
massive compiler misfeature. This even saves you a couple of
characters :-)
Ok, I could turn off such warnings in Microsoft C 5.1, but this turns
off some useful checks as a side-effect! Please, Microsoft, make a
"prototypes-off" switch into Microsoft C for me!
If the compiler really does complain in the case where you give the
full type in the function definition then I agree that the writers had
better start watching out for mobs of irate users coming after them
with pitchforks and flaming torches. Someone must make a working C
compiler for your machine...
--
rjc at uk.ac.ed.cstr
More information about the Comp.lang.c
mailing list