Ad
  • Default User Avatar

    I have heard opinions that it is best to stick to the standard of the project you work in, so that the new code is written in a similar style, then the code is easier to read. Unfortunately most C/C++ projects are very old, so they are written in different styles, then refactoring the file you are changing looks like a good approach.

  • Default User Avatar

    I cannot agree with that for the above case.
    Since we have a return in each if, the program will not check the next conditions. So using an else if here will have the same effect and it only increases the length of the code and may only be puzzling for the reader of the code why some put else keyword.