On 02/26/2009 08:46 PM, Amos Jeffries wrote: > Kinkie wrote: >>> * Please use .length() everywhere you can. Do not mix .len_ and >>> .length(). >> Ok, checked. >> I've left len_ where it's being assigned to another object's len_ or >> in very low-level stuff (e.g. object dumping, stuff doing pointer >> maths). > Um, IMO its better to be liberal with length() and very,very > conservative with len_. > > Dumping stuff and pointer maths particularly is one place its often > better/safer to use "const length() const" instead of len_, unless the > math is actually intended to change len_. Yeah. For zero-overhead wrapper methods like length(), the rule of thumb is very simple: use the wrapper method unless you modify the data member (or take its address).
Cheers, Alex.
