Changes between Version 28 and Version 29 of Coding_Conventions


Ignore:
Timestamp:
Jul 14, 2015, 6:38:18 PM (9 years ago)
Author:
Itms
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Coding_Conventions

    v28 v29  
    230230 * Be sure to be aware of [CodeAndMemoryPerformance Code And Memory Performance] guidelines
    231231
    232  * Use "for range" loop instead of "std::for_each" when you use "begin()" and "end()" parameters
    233 {{{
    234 #!cpp
    235 //Avoid
     232 * Use "for range" loop instead of "std::for_each".
     233{{{
     234#!cpp
     235// Avoid
    236236std::vector<T> anyVector;
    237237std::for_each(anyVector.begin(), anyVector.end(), [] (const T& element){
     
    239239}
    240240
    241 //Better
    242 for (auto& element : anyVector)
     241// Better
     242for (const T& element : anyVector)
    243243{
    244244   //code
     245}
     246}}}
     247
     248 * Reminding the default value of parameters, if any, in a function definition can be useful.
     249{{{
     250#!cpp
     251int Increase(int param, int optionalParam = 1);
     252
     253//...
     254
     255int Increase(int param, int optionalParam /* = 1 */)
     256{
     257   return param + optionalParam;
    245258}
    246259}}}