CODINGSTYLE 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. SuperTux Coding Standards
  2. =========================
  3. * start member variable name with "m_", global variables with "g_" and
  4. static variables with "s_"
  5. * avoid spaces at the end of lines
  6. * proper separation between generic engine code and game specific code
  7. should be done whenever feasible
  8. * the path in #include directives must not contain "..", all paths
  9. must be relative to the src/ directory
  10. * external libraries are not allowed in src/, they go to external/
  11. * do not use raw pointer and new/delete, use std::unique_ptr<> instead
  12. * properly separate data members and member functions, don't mix them
  13. in the same public/private/protected section
  14. * conditional includes should be indented:
  15. #ifdef FOOBAR
  16. # include "foobar.hpp"
  17. #endif
  18. * use #include <> for libraries in external/
  19. * include guards are of the form:
  20. #ifndef HEADER_SUPERTUX_{PATH}_{FILE}_HPP
  21. #define HEADER_SUPERTUX_{PATH}_{FILE}_HPP
  22. * use one file per class
  23. * write namespaces like: "namespace NameSpace {", no newline before the '{', finish them with:
  24. "} // namespace Namespace"
  25. * compile with the maximum warning level and with -Werror:
  26. -Werror -ansi -pedantic -Wall -Wextra -Wnon-virtual-dtor -Weffc++
  27. -Wcast-qual -Winit-self -Wno-unused-parameter
  28. possible additional flags for the future: -Wconversion -Wshadow
  29. * write doxygen comments as:
  30. /** This is a comment */
  31. do not use /**< and other styles of comments
  32. * write regular comments with //, not with /* */
  33. * more info on good practices can be found at:
  34. http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml
  35. # EOF #