Testing as a Developer
One of the more recent posts in my employer's company blog is titled 'What’s wrong with: “I don’t write any tests since I am not a tester”?' - which made me think about the relation of developers to...
View ArticleNew C++ features – lambdas
Having covered the basics of `auto` and rvalue references, there is a third big new C++ feature definitely worth knowing about: creating function objects on the fly with lambda expressions. Continue...
View ArticleLambdas Part 2: Capture Lists and Stateful Closures
In the last post of my series about (relatively) new C++ features I introduced lambda expressions, which define and create function objects on the fly. I left a few details untouched, such as what the...
View ArticleClean up the Build
Every now and then we have to change something in our build procedure, and more often than not those changes are a real pain. Build scripts are the step children of many software projects. Someone...
View ArticleWhom are we Writing Code for?
Since my blog touches clean code topics a lot, I often mention maintainability. In turn, readability plays a major part in maintainability, since what we can’t read properly, we can’t analyze, debug,...
View ArticleDon’t Believe What They Say
A programmer who has not mentally resigned already, is constantly learning. This includes taking lessons, listening to talks, reading books and of course blogs and other resources on the web. However,...
View ArticleManaging Object Ownership
Managing the lifetime of dynamically allocated memory and the objects residing in it is one of the challenges that can be hard to do right. It is usually handled by assigning […]
View ArticleNew C++ Features – templated rvalue References and std::forward
Combining rvalue references with templated function parameters or `auto` behaves quite differently than "normal" rvalue references. Together with the utility function template `std::forward` they allow...
View Articlervalue References Wrap Up
The last weeks I have been writing a lot about move semantics, move operations, rvalue references and forwarding references. While it might take a bit of getting used to all this, there's good news.
View ArticleTesting as a Developer
One of the more recent posts in my employer's company blog is titled 'What’s wrong with: “I don’t write any tests since I am not a tester”?' - which made me think about the relation of developers to...
View Articleshared_ptr Versus unique_ptr in Factory Functions
When it comes to factory functions there is often dispute on which kind of smart pointers to return. As it turns out, the choice depends on the circumstances, so here's a list of pros and cons.
View ArticleModern C++ Features – override and final
Today I write about a pair of less often discussed, less complicated features introduced in C++11, which are nevertheless useful. Both can provide some additional security and clarity when it comes […]
View ArticleModern C++ Features – nullptr
Probably everybody who has written C++03 code had the pleasure of using NULL and stumbling over one pitfall or another. C++11 brought the solution to those issues with nullptr. What is NULL? […]
View ArticleLevels of Exception Safety
Exceptions are part of C++. They are thrown by the standard library classes, and sometimes even if we are not really using the standard library. So, unless we are in a very restrictive […]
View ArticleModern C++ Features – keyword `noexcept`
I have written about handling exceptions some time ago, and about the levels of exception safety last week. What I have not touched yet are exception specifications. I will catch […]
View ArticleC++ Object Lifetimes
Some of the most surprising bugs I have come across happened when someone (often enough myself) accessed an object outside of its lifetime. There are some pitfalls, common misunderstandings and […]
View ArticleAvoid Invalid State
Have you seen classes with a method isValid() or something similar? You most definitely have seen and even used such classes. Maybe you have even written such a method yourself. […] The post Avoid...
View ArticleConstructor Failures
Sometimes we fail to acquire a needed resource or responsibility during the construction of an object. Sometimes the construction of a subobject fails. How can we deal with an incompletely […] The post...
View ArticleGet rid of those cheat sheets!
This is another post motivated by Twitter: It’s about those cheat sheets, for example those showing C++ operator precedence, that some people have stick to their monitor or cubicle wall. Unless they...
View ArticleModern C++ features: in-place construction
Move constructors are often cheaper than copy constructors, which makes the construction and immediate relocation of objects in modern C++ more effective than in C++03. However, just moving the parts...
View Article