Skip to content

Atomic lint misc

hgratten requested to merge atomic_lint_misc into master

this merge request contains some left-over miscellaneous changes from the hgratten branch, related to linting:

LectureCodes/Interpolation/DividedDifferencesEval/Eigen/CMakeLists.txt:

  • removed cmake_minimum_required(VERSION 2.8), since the cmake version is better handled by the global CMakeLists.txt file

LectureCodes/NewtonMethod/main.cpp:

  • reordered includes as good practice (user header first, then system headers, ordered alphabetically
  • avoided multiple declarations in a single line for readability
  • wrapped body statement of if-else, for, do while, and while in braces. increases readability and forgetting braces is a common source of bugs for students
  • lifted all things thrown to derive from std::exception, since the C++ standard library's exception handling mechanism is designed around the std::exception base class and otherwise leads to problem in catching (e.g. does not allow polymorphic catching)
  • introduced const wherever possible
  • ignored locally bugprone-exception-escape: a subroutine (e.g. newton1Ddriver) may throw an exception, but in this case we want the program to exit
  • avoided pointer arithmetic, instead used span, which is safe to index
  • replaced atoi with strtol since, atoi does not check the validity of the conversion and does not detect errors
  • avoided else after return since it reduces readability of code flow when it comes to main and exit error codes and quickly causes bugs

Utils/void_cb.hpp:

  • added comment for unused paramter

Merge request reports

Loading