Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestions for improved code maintainability #5

Open
wlenthe opened this issue Oct 25, 2019 · 0 comments
Open

Suggestions for improved code maintainability #5

wlenthe opened this issue Oct 25, 2019 · 0 comments
Labels
documentation Improvements or additions to documentation

Comments

@wlenthe
Copy link
Collaborator

wlenthe commented Oct 25, 2019

Moving code suggestions from text file to issue, see e74f766 for history before files were deleted

SHTfile Code Review

Over all a good piece of code and reasonably well written but there are some maintainability
issues that should be addressed before general consumption by a larger community
is established.

Formatting

While the file is formatted with an eye towards presentation rather than adhering to
any standard. The use of a .clang-format file will save future maintainers from having
to tediously follow an arbitrary and undoumented formatting scheme.

  • Modern C++ eschews the use of structures like the following:

      char Something[8] = ".........."; // Not typical in modern C++
      std::array<char, 8> = { "........" };
    
  • Use 'nullptr' when you mean a null pointer, prefer not to use 0 (zero) or NULL.

      typename std::enable_if< std::is_pointer<T>::value >::type* = 0 //
      typename std::enable_if< std::is_pointer<T>::value >::type* = nullptr // Preferable
    
  • Overriden methods should be marked as such.

      void sanityCheck() const override;
    
  • Use 'override' on destructors if that is what the intention is

      ~AtomData() = default;
    
  • Use of old style or c-style casts

      noteLen() = (int16_t)str.size();
      noteLen() = static_cast<int16_t>(str.size()); // Preferable
    

Auto Formatting

use a clang-tidy and clang-format file to automatically enforce style guidelines

@wlenthe wlenthe added the documentation Improvements or additions to documentation label Oct 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant