|
From: Larry D. <ldo...@re...> - 2014-07-11 20:00:04
|
Steve -
On Fri, Jul 11, 2014 at 12:27:32PM -0700, Stephen Williams wrote:
> I admit that I do not really know what the problem is.
> Sure, we should change "void sys_time_register();"
> to "void sys_time_register(void);", but what else could
> the compiler be warning us about?
It's trying to save us from ourselves, in the same vein as
complaining about the perfectly valid
if (foo=fopen("name","w")) ....
and making us write
if ((foo=fopen("name","w"))) ....
just because = vs. == is such a common mistake.
If you don't have a prototype for a function, it normally means
either (a) you should declare it with a prototype in a header
file that is shared between the function definition and the places
it is called, so the arguments can be checked for consistency between
the definition and the callers, or (b) it's only used in this
"compilation unit" and therefore should be declared static, to
avoid polluting the global name space and allow more optimization.
Looking literally at this case, it's squarely in case (a) above,
although the argument list to be checked is (void). Following the
usual process slavishly gives my option #3
> 3. Create 20 new .h files, each declaring foo_register(void). #include
> all 20 of these files in sys_table.c. Creates quite a bit of fluff for
> not much benefit.
- Larry
|