Common misconception with C++ move semantics

Move semantics have to be one of the most prominent new features in C++11. It is also something that can be a source of misunderstandings if the underlying mechanics are not fully understood. The fact is that std::move does not actually move anything. Yet, its name would suggest otherwise. So, let’s clear up this misconception.
Continue reading “Common misconception with C++ move semantics”

C++ tips for easier unit testing

A while back I read the Working Effectively with Legacy Code by Michael C. Feathers. The book focuses on strategies and approaches to get existing untested legacy code covered by unit tests.

The book also includes more than twenty dependency-breaking techniques that can be used for new code as well to make it easily testable in the first place. Here I have picked three of the techniques that I have personally found most useful.

  • Interfaces to abstract implementation
  • Extract and override call
  • Expose static method

Continue reading “C++ tips for easier unit testing”