News for hackers. Stuff that matters.
Re:A C++ Immutable String class by to3m on Saturday September 21, 2013 @01:36PM (#6423717)
No, the caller is saying that the callee isn't permitted to change the value! That's what const means. No promise is made about the actual object itself. There's no general way to specify that in C++.

This isn't so much an issue for functions, where the caller is stopped while the callee runs, but it needs to be borne in mind for longer-lived objects that take const references - or, indeed, const pointers - to objects that have longer lifetimes again. (I don't think multithreading need be introduced for this to be an issue.)

There's quite a difference between an object that could change and one that won't, if you're considering caching values across method calls, or setting up the referring object based on the referred object's current state, etc.

Re:A C++ Immutable String class by alexchamberlain on Saturday September 21, 2013 @04:34PM (#6424402)
Ok, I know what the spec says, but it is utterly rediculous to expect people to write code in which parameters are allowed to change in an undefined way.
Re:A C++ Immutable String class by dllthomas on Saturday September 21, 2013 @02:01PM (#6423814)
Right, multithreading is needed for it to be an issue with functions, not with containers.