Before I continue with the roughly 15 rules for statements, let me finish the two rules for expressions. Both rules help you to protect your program from undefined behaviour.
This post is about don'ts. Here are the two most important rules of this post: Don't use std::move thoughtless and don't slice. Let's start.
What have narrowing conversion and casts in common? They are very often the source of errors; therefore, I will today write about errors.
I know the headline to this post is a little bit boring: More Rules for Expressions. Honestly, this post is about code hygiene, because I will mainly write about pointers.
Today's post is about expressions. You should avoid complicated expressions, you should know the precedence rules for arithmetic or logical expressions, and you should know the order of evaluation of expressions. Having the wrong precedence rules for expressions in mind or assuming an evaluation order for expressions which is just wrong or not guaranteed are the main reasons for undefined behaviour. I know that's a lot to digest. Let's start.
In this post, I will finish the rules for declarations. The remaining rules for declarations are not especially sophisticated but important for high code quality.
Let's continue our tour through the rules for expressions and statements in the C++ core guidelines. This post will be about declarations and initialisations.
There are quite a lot of rules in the C++ Core Guidelines dealing with expressions and statements. To be precise, there are more than 50 rules are about declarations, expressions, statements, and arithmetic expressions.
Passing smart pointers is an important topic which is seldom addressed. This ends with the C++ core guidelines because they have six rules for passing std::shared_ptr and std::unique_ptr.
There were a lot of C++ experts who said that smart pointers were the most important feature of C++11. Today, I will write about smart pointers in C++.
Currently are 158 guests and no members online
Kubik-Rubik Joomla! Extensions