[webkit-dev] Do we have a style preference about const member functions?

Simon Fraser simon.fraser at apple.com
Mon May 30 22:23:24 PDT 2011


On May 30, 2011, at 4:19 PM, Geoffrey Garen wrote:

> Updated:
> 
> Const member functions:
> 
> Do use const member functions in classes that are independent data holders, to help distinguish between references that can modify the data and references that can't.
> 
> Do not use const member functions in classes that participate in object graphs, since the distinction is weak. Do not use const member functions for DOM or render tree nodes.

Even in a class that is used in a tree, I still think simple member variable accessor methods (that do not return tree neighbors)  should be const.

Simon




More information about the webkit-dev mailing list