April 2017
Beginner to intermediate
394 pages
9h 16m
English
As we said before, const isn't magic. It doesn't make your code 100% secure and protected. Knowing and understanding the rules related with const parameters and const member function will help prevent mistakes. However, failing to understand the rules and behaviors of const can lead to bugs.
The biggest problem with const in C++ is a misunderstanding of bitwise const versus logical const. This means that the compiler will try to ensure that the bits and bytes will not change through that specific variable. This doesn't mean that those bits won't change through another variable, and it doesn't mean that the data you may care about won't change. Consider the following code:
//Example of modifying const bits through different ...
Read now
Unlock full access