tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: missing-prototypes enabled in bsd.sys.mk
Date: Sun, 27 May 2018 18:07:40 +0000 (UTC)
From: christos%astron.com@localhost (Christos Zoulas)
Message-ID: <pees5c$17s$1%blaine.gmane.org@localhost>
| It is still useful; consider the following example. You have a file that
| contains:
|
| int foo(void) { return 1; }
| int main(void) { return foo(); }
[I squashed those up to make the mail take less vertical space ...]
| This will warn; you either want to make foo() static, or you want to
| have a prototype declaration in scope from a header file which means
| that the function can be used from outside the file scope.
Typically I want neither of those - I want foo() to be global, so it gets
entered in the global symtab for nm -g and remains after cc -x
but I am not expecting it to be called from anywhere but this one
location (and certainly not outside this file.)
My typical "solution" is simply to shove
int foo(void);
immediately before the "int foo(void) {" line,
which silences the warning, but is otherwise just a waste of space.
kre
Home |
Main Index |
Thread Index |
Old Index