• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: error: invalid use of 'static' in linkage specification
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • [SOLVED] Re: error: invalid use of 'static' in linkage specification
      • From: Dieter Oberkofler <email@hidden>
References: 
 >Re: error: invalid use of 'static' in linkage specification (From: Greg Guerin <email@hidden>)
 >Re: error: invalid use of 'static' in linkage specification (From: Dieter Oberkofler <email@hidden>)

  • Prev by Date: Re: No UNIX Development Tools on Snow Leopard
  • Next by Date: where is the "Xcode Project Management Guide"?
  • Previous by thread: Re: error: invalid use of 'static' in linkage specification
  • Next by thread: [SOLVED] Re: error: invalid use of 'static' in linkage specification
  • Index(es):
    • Date
    • Thread