|
|
|
|
|
by kevindqc
2467 days ago
|
|
I think you just need to read right to left? "const int * foo"
means that
foo is a pointer to an int that is constant. Which could also be
"int const * foo"
foo is a pointer to a constant int. But since the const qualifier for pointers can't be reordered like this, I think the point is that it's a better practice to have the const come after, so that it ALWAYS come after in your codebase regardless of the context? |
|
C++ rvalue references are a great example. Whenever I see them I have to go back and relearn the concept because accounting for the language feature sometimes feels more complicated to get right than the unsafe pointer chucking it replaced.