R
Ravi
Hi All:
Is there any reason for declaring functions as static in a header file
if that header file is going to be included in several other files? The
compiler throws a warning for every such function declared but not
called in the source file. Here is what I heard someone mention:
The functions are declared static as an optimization. Making static
"hidden-from-the-user" function to extern to appease -Wall compile
argument is not a good solution since extern functions have additional
overhead at compile/run time.
Is this true? What overhead is saved by declaring the functions static?
Are there any rules of thumb for when to declare functions static as
opposed to extern in header files? Any pointers in this regard are
appreciated.
thanks,
-Ravi.
Is there any reason for declaring functions as static in a header file
if that header file is going to be included in several other files? The
compiler throws a warning for every such function declared but not
called in the source file. Here is what I heard someone mention:
The functions are declared static as an optimization. Making static
"hidden-from-the-user" function to extern to appease -Wall compile
argument is not a good solution since extern functions have additional
overhead at compile/run time.
Is this true? What overhead is saved by declaring the functions static?
Are there any rules of thumb for when to declare functions static as
opposed to extern in header files? Any pointers in this regard are
appreciated.
thanks,
-Ravi.