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
Home » Tip Bank » C++
Language: C++
Expertise: All
Jun 12, 2000

Declarations With Implicit int Aren't Permitted

Does your compiler accept the following declarations?

 
 volatile x;
 const y  = 0;
 

In pre-standard C++, the default type in such incomplete declarations was int. Thus, the first declaration would declare x as "volatile int" and y as "const int. " However, according to the C++ standard, declarations with implicit int aren't permitted anymore. Instead, you have to specify the variable's type explicitly:

 
 volatile int x; // OK
 const int y  = 0; // OK

Many compilers aren't yet compliant in this respect and accept the incomplete declarations given above. You shouldn't count on this because future versions of your compiler will probably flag such declarations as errors.

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