The following list shows a few common mistakes you will find in code you will have to review before its
Continue readingCategory: Programming
Threading – Reduce locks (C++)
With multithreading, you have to be careful to not create race conditions. The default way to do this is the
Continue readingDestruction order (C++)
The variables/fields getting cleanup in the reverse order they have been declared (not initialized). … Objects are created # Cleanup
Continue readingCyclic dependencies (C++)
Issue The cyclic dependency is a problem which occurs if two classes includes each other in their header. hen.hpp egg.hpp
Continue readingOperating System APIs (C++)
Before using the OS APIs directly, take a look if the STL or boost already provides this functionality. Also be
Continue readingCode documentation (Doxygen)
General Always document large software projects, so other programmers can understand your code. Consider using tools like Javadoc or Doxygen
Continue readingWhen to use which cast (C++)
Types Type Area Risk static_cast – Converts fundamental types– Non-const to const– Down-casts (dangerous) Medium dynamic_cast – Down- and side-casts
Continue readingCyclic references (C++)
Problem The following code shows the problem of a cyclic reference with shared pointers. When leaving the main function the
Continue readingFunction pointer vs. std::function vs Function template
Showcase Code ▼ Compiler ▼ – Tool: godbolt.org – Compiler: x86-64 Clang 16.0.0 – Args: -std=c++20 – Output: Intel asm
Continue readingData structures – Overview (libstdc++)
The “C++ standard library” isn’t defining implementation details of the data structures, it just defines their behavior. The libstdc++ is
Continue reading