Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) 'auto' will change meaning in C++0x; please remove it

 

Compile warning.

 

 

 

 

 

Full warning message

 

MyMain.cpp:3: warning: 'auto' will change meaning in C++0x; please remove it

 

 

 

 

 

Cause

 

IDE: Qt Creator 1.2.1

Compiler: G++ 4.4.1

Project type: Qt4 Console Application

 

int main()
{
  auto int x = 3;
}

 

 

 

 

 

Solution

 

Remove auto. Never use auto [1], until C++11 arrives.

 

 

 

 

 

References

 

  1. Herb Sutter. Exceptional C++ style. 2005. ISBN: 0-201-76042-8. Item 28 guideline: 'Never write auto'.

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict