Original message from Diego Giagio [EMAIL PROTECTED]:
> ...
> I have a concern, thought: why most applications don't use the 'static' 
> keyword for 
> functions with internal linkage ? Wouldn't that avoid function name clashes 
> when 
> developing large programs? 

Either because:
1.  there are debugging requirements.  Static functions do not expose entry 
points.
2.  most developers don't consider limiting global namespace pollution as this 
doesn't frequently hinder development.  Consider being concerned about how many 
names are in the global namespace the programmatic equivalent to flossing.

As an aside, note in C++ that the keyword "static" is even less in vogue than 
it was in C given its overuse within the language definition.  "static" has at 
least five distinct meaning based upon its context:
1.  "static" global instances -- no public linkage for names are created in 
object files.
2.  "static" automatic variables within functions -- "
3.  "static" functions -- "
4.  "static" members within class definitions -- class variables of which one 
instance is shared across all instances of the class.
5.  "static" member functions -- functions with no knowledge of individual 
class instances other than whatever static members which may be defined.

There may be a sixth, but I haven't verified it lately.  This may only be a 
compiler implementation issue:
6.?  "static" constants -- may force the compiler to allocated memory for the 
instance.

This isn't to say that there are equivalents elsewhere in the language which 
obviate all uses of "static", but namespaces sidesteps some of these issues.

Jim

Reply via email to