ANSI C prototypes
Kari Hurtta
hurtta at cs.Helsinki.FI
Tue Nov 6 01:03:23 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? The prototype should be necessary only if I make a
forward reference to make it easier for the compiler to check types in a
single pass. I think the function definition tells unambiguously the
types, so I should not have to watch warnings such as "function
definition used as a prototype" (Microsoft C 5.1).
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!
Why not:
static void auxiliary_func(int a)
{
...
}
void visible_fun(int b)
{
...
auxiliary_func(b+1);
...
}
- K E H
( hurtta at cc.Helsinki.FI
hurtta at cs.Helsinki.FI
HURTTA at FINUH.BITNET
)
More information about the Comp.lang.c
mailing list