On Sep 17, 2009, at 12:09 AM, Dieter Oberkofler wrote:
Sure, but extern "C" is a linkage specification needed to link with C code from a C++ application and this "should" be valid!
"static" has two distinct meanings in C++. When it is applied to a member of a class it means that the member (data or function) belongs to the class and not to any individual object. When it is applied to a non-member it means that the name is visible only within the compilation unit.
The latter meaning comes from C, and it is opposite to "extern", hence incompatible. The C++ meaning has nothing to do with linkage or visibility. The two uses cannot be confused by the compiler, but they certainly can be by the programmer.
In "The Design and Evolution of C++", Bjarne Stroustrup says that the old meaning of "static" is deprecated and can be accomplished by using unnamed namespaces, leaving "static" with its new, C++ meaning. Of course that hasn't happened, and we are left with two meanings, plus the weird phrase "unnamed namespace".
David