Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language:
Expertise: Beginner
Sep 3, 1999

Correctly Defining a Function in an Unnamed Namespace

The use of the static keyword is deprecated when declaring objects in a namespace scope; the unnamed-namespace provides a superior alternative. Nonetheless, it is important to know how to define the members of an unnamed namespace correctly. Declaring a function in an unnamed namespace and defining it later, somewhere outside that unnamed namespace, is a common mistake:
 
namespace 
{
  void func(); //only a declaration
}

void func() //most likely an error
{
  //
Danny Kalev
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date