Compiler Warnings Part 1 – Treat Them Right
We often see compiler warnings about pieces of code that have potential problems or poor style. Sometimes they point out code that is actually wrong, so don’t ignore them. You’ve probably seen already...
View ArticleCompiler Warnings Part 2 – Tune the Compiler
In the last post I wrote about how to change our code to avoid getting compiler warnings. Sometimes that is not a feasible approach and we need to tell your compiler […] The post Compiler Warnings Part...
View ArticleUse a static analyzer or two
In the last two posts I have written about compiler warnings. There’s much more to getting hints about code smells and potentially problematic pieces of code than that. That’s the job […] The post Use...
View ArticleDo Domain Specific Languages add Complexity to Plain C++?
C++ itself is complex enough. Adding domain specific languages can seem like yet another addition to that complexity. So why would we use a DSL instead of a normal library? […] The post Do Domain...
View ArticleScripting Languages and C++
C++ programmers often praise their statically typed language. Having a compilation phase with the possibility to statically check for possible errors is a feature that makes good for the time […] The...
View ArticleMore About Adopting Scripting Languages
In last week’s post I wrote about adding a scripting language to our toolset. I focused on the benefits a scripting language like e.g. Python can bring, especially when it […] The post More About...
View ArticleRefactoring Session #1: Statements, Lists and Inheritance
I’ll try something new today: I pick a piece of code from the web and see what improvements I would make to it, using small refactoring steps. I got across […] The post Refactoring Session #1:...
View ArticleStrings vs. Enumerators
Sometimes, a fixed set of string values is allowed as input. Often these string values are then stored, used for control flow etc. Enumerators are a better alternative. The example […] The post Strings...
View ArticleEnum vs. Class Hierarchies
When an enum controls the behavior of a class, that behavior can sometimes be expressed by class hierarchies. Last week I wrote about replacing a fixed set of strings with an […] The post Enum vs....
View ArticleVisitor Pattern Part 1- the Object Oriented Way
If you have read the “Gang of Four” book about design patterns or just have been long enough in software development, you will have heard of the Visitor pattern. In its fully […] The post Visitor...
View ArticleVisitor Pattern Part 2 – the enum based visitor
In my last post I showed the Visitor design pattern in its fully object oriented implementation. In the post before that I wrote about moving from enums to class hierarchies. I […] The post Visitor...
View ArticleCovariance with Smart Pointers
Covariance can be a useful concept, e.g. when implementing the abstract factory design pattern. However, in modern C++, we should return smart pointers that are not recognized to be covariant like […]...
View ArticleDevelopment Environment: Make the Setup Simple
You may be working on a small open source project or on a large corporate team. In either case you will probably have new team members coming in the future. […] The post Development Environment: Make...
View ArticleRAII versus Exceptions
Recently I received a question on Twitter whether to prefer RAII over Exceptions. I have seen similar questions being asked again and again over time, so there seems to be […] The post RAII versus...
View ArticleClean Documentation
“Is there some documentation how I have to configure my IDE to integrate and debug those components?” – “Yes. Have a look at the Wiki. Or maybe there is some […] The post Clean Documentation appeared...
View ArticleCompile Time Constants Part 1: Why We Need Them
Compile time constants are an important part of C++. They contribute to program correctness and allow the optimizer to do a better job. Today I will deal with what is possible […] The post Compile Time...
View ArticleCompile Time Constants Part 2: Compile Time Calculations
I have written about what we need compile time constants for last week. This time I will dig a bit into where we can get compile time constants from, and […] The post Compile Time Constants Part 2:...
View ArticleModern C++ Features – constexpr
In the last two weeks I have written about the basics of compile time constants and calculation with those constants. This week I conclude this mini series with the keyword […] The post Modern C++...
View ArticleSource File Organization for C++ Projects Part 1: Headers and Sources
Any C++ developer knows how to compile and link multiple compilation units together. The difficult part can be to determine which parts of the code should be separated in different compilation […] The...
View ArticleSource File Organization for C++ Projects Part 2: Directories and Namespaces
Since my last post you know what I think how C++ code should be split into header and source files. But where should we put those files? How should the directory structure […] The post Source File...
View Article