J
Jeffrey Schwab
Under what cicumstances is the keyword "static" (?:not)? deprecated?
Jeffrey Schwab said:Under what cicumstances is the keyword "static" (?:not)? deprecated?
Victor said:IIRC, to declare a function for use only in the translation unit where
it's defined. The Standard recommends the use of anonymous namespace
for that. There is a difference there (static function has internal
linkage), but the result is basically the same: the symbol's name is
not known outside the translation unit.
Victor
Jeffrey Schwab said:Thanks for the concise explanation!
So, even when I declare the internal functions of a module in an
anonymous namespace, they have external linkage?
Yes.
Do the extra,
externally linked symbols slow the typical linker?
linkage?If so, is there any
non-deprecated way to declare functions that do *not* have external
Victor said:Not significantly, I'd think.
linkage?
Not accessible from all scopes in a translation unit. You could define
an internal to a function class, members of that class don't have linkage
IIRC.
Jeffrey Schwab said:That's a good idea, but then those classes can't be arguments to
templates that are defined outside the function, right?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.