How not_null can improve your code?

One of the key points of modern C++, as I observe, is to be expressive and use proper types. For example, regarding null pointers, rather than just writing a comment: void Foo(int* pInt); // pInt cannot be null I should actually use not_null<int *> pInt. The code looks great now, isn’t it?

READ MORE...

Learning from bugs and PVS-Studio Team

Real life: Fixed 1 out of 99 bugs in a project. 117 to go… Have you experienced something similar? Although it’s impossible to write bug-free code, there are tools and practices to lower the rate of mistakes. Today, I’d like to run through a gigantic list of freely available resources from the PVS-Studio Team who works with bugs analysis on a daily basis.

READ MORE...

Modernize: Sink Functions

One of the guidelines from Modern C++ is to avoid using raw new and delete. Instead, you should use a smart pointer, a container or other RAII object. Today I’d like to focus on so-called ‘sink functions’ that takes ownership of input parameters. How can we modernize code around such calls?

READ MORE...