It's not clear to me what benefits there are of declaring your stack variables as constant in C++, I was hoping somebody might explain the benefits and purpose for this technique.
For example:
void func(const std::string& arg)
{
if(someCondition)
{
const std::string foo ("some string plus " + arg);
std::out << foo << std::endl;
someFunction(foo);
// dozens more lines of code...
}
// bla bla bla...
}
Thanks!