08
Dec
How is “const correctness” related to ordinary type safety?
Related Blog Items
- How can inline functions help with the tradeoff of safety vs. speed?
- const correctness
- What's the difference between "const X* p", "X* const p" and "const X* const p"?
- Differences between new, malloc; delete, free
- Constant and Volatile
Declaring the const-ness of a parameter is just another form of type safety. It is almost as if a const std::string, for example, is a different class than an ordinary std::string, since the const variant is missing the various mutative operations in the non-const variant (e.g., you can imagine that a const std::string simply doesn’t have an assignment operator).
If you find ordinary type safety helps you get systems correct (it does; especially in large systems), you’ll find const correctness helps also.
source: usenet
Popularity: 3%
You need to log on to convert this article into PDF
Related Blog Items - How can inline functions help with the tradeoff of safety vs. speed?
- const correctness
- What's the difference between "const X* p", "X* const p" and "const X* const p"?
- Differences between new, malloc; delete, free
- Constant and Volatile
Related Blog Items
- How can inline functions help with the tradeoff of safety vs. speed?
- const correctness
- What's the difference between "const X* p", "X* const p" and "const X* const p"?
- Differences between new, malloc; delete, free
- Constant and Volatile
No Comments
No comments yet.