Ali Çehreli wrote: > On 01/02/2015 10:10 PM, ted wrote: > > > I'm now taking the view that const is there for the compiler to > > optimise code on the basis that nothing can alter it once set (and can > > only be set on initialisation). > > Of course, that is true for const values, not for const references. In > the latter case it means "I will not modify but others may modify", so > the optimization that you mention does not apply to const in general. > However, immutable can be used for optimization. > > Ali
....thats (sort of) where I had started from..... My (clearly incorrect) interpretation was that reinitialising 'myTest1' was part of the 'others may modify' category because of the fact that it was in scope of the _someFunc function.... ...anyway....lots to learn. BTW: your book is excellent, and as soon as you have it available for purchase I will certainly be buying a copy.