Skip to content
Raul Metsma edited this page Sep 30, 2021 · 11 revisions

Code Best Practices

  • Store openssl objects std::shared_ptr. Shared pointer keeps reference count and when coping objects the shared_ptr's inside both objects will be referring to the same underlying object. Also C++11 handles move operators.
  • Avoid third party library includes (openssl, xerces-c...) in headers, especially public headers. Use forward declaration when needed. It also speeds up build and do not require third party developers adjust include paths.
  • Keep public headers clean, even from documentation. It is easier to read and helps IDE-s with code completion. Write doxygen documentation in source files.
  • Do not break ABI/API when absolutely needed. Public symbols are marked with "DIGIDOCPP_EXPORT". ToDo add tests (https://github.com/lvc/abi-compliance-checker). See https://community.kde.org/Policies/Binary_Compatibility_Issues_With_C%2B%2B.
Clone this wiki locally