C++ style guide: Difference between revisions

Jump to navigation Jump to search
543 bytes added ,  20 June 2016
→‎Other C++ features: add section for auto
(→‎Other C++ features: C++11 is now allowed and C++14 is the new not allowed)
(→‎Other C++ features: add section for auto)
Line 45: Line 45:
C++11 features are generally allowed. Check if the feature you want to
C++11 features are generally allowed. Check if the feature you want to
use has been already used.  If not, ask on the mailing list.
use has been already used.  If not, ask on the mailing list.
==== auto ====
Use of {{codeline|auto}} is allowed only where it helps readability
and local variables.
* Never use auto for class members.
* Do not use {{codeline|auto}} unless the type really is obscure.
* Beware of copy when using {{codeline|auto}} in for loops. Pass by reference and use {{codeline|const}} unless you're dealing with simple types such as {{codeline|int}}. See [http://lists.gnu.org/archive/html/octave-maintainers/2016-06/msg00144.html 'auto' uses and for-range loops] on the maintainers mailing list for more details.


=== C++14 ===
=== C++14 ===

Navigation menu