Re: error: invalid use of 'static' in linkage specification
Re: error: invalid use of 'static' in linkage specification
- Subject: Re: error: invalid use of 'static' in linkage specification
- From: David Rowland <email@hidden>
- Date: Thu, 17 Sep 2009 07:35:14 -0700
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
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden