devxlogo

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.

Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.

See also  Five Early Architecture Decisions That Quietly Get Expensive

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.