Tag Archives: const correctness

When Should You Use const_cast?

C++ provides an explicit casting mechanism called const_cast, and yet the question pops up: when would I ever use this? You can always assign a non-const value to a const value without requiring a cast operation. So you don’t need … Continue reading

Posted in C/C++ | Tagged , , | 7 Comments

When Const isn’t Const, it’s Mutable

I’m a programmer who strives to write const-correct code. I’ll admit that it can be challenging, but once you get used to doing it, your code is generally cleaner and more maintainable. This happens at the expense of flexibility. When … Continue reading

Posted in C/C++ | Tagged , | Leave a comment