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



On May 28,  7:06am, kre%munnari.OZ.AU@localhost (Robert Elz) wrote:
-- Subject: Re: missing-prototypes enabled in bsd.sys.mk

| 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.

Ok, "foo" is in the global namespace. How do you use it outside of that
file context? Do you add a prototype on a different file, before you call
it?

And yes, if you want to make it global and not usable outside of that
file context, you need to add the prototype as you describe. But this
is not the general use case.

christos


Home | Main Index | Thread Index | Old Index