Skip to content

Latest commit

 

History

History
132 lines (87 loc) · 3.27 KB

CppAuto.md

File metadata and controls

132 lines (87 loc) · 3.27 KB

auto is a keyword that has different meanings, depending on the standard used:

 

In the C++11 Standard, auto is useful to let the compiler determine a variable's data type

 

 

 

 

 

 

auto as described in the ISO/IEC 14882:2003 C++ Standard is a keyword to specify that a locally declared variable is destroyed at the end of its scope. In other words: to specify to do, what already will be done. In C++98, never write auto [1]

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  1. Herb Sutter. Exceptional C++ style. 2005. ISBN: 0-201-76042-8. Item 28 guideline: 'Never write auto'.
  2. Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 31.6. Advice. page 924: '[17] Use auto to avoid verbosity and typos when you use iterators'
  3. Scott Meyers. C++ And Beyond 2012 session: 'Initial thoughts on Effective C++11'. 2012. 'Prefer auto to Explicit Type Declarations'
  4. Scott Meyers. C++ And Beyond 2012 session: 'Initial thoughts on Effective C++11'. 2012. 'Remember that auto + { expr } == std::initializer_list'
  5. Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 6.6. Advice, page 169: '[20] Prefer the = syntax for the initialization in declarations using auto'