On Tue, May 31, 2011 at 11:00 AM, Maciej Stachowiak <[email protected]> wrote:

> I agree that const should be used for "logical constness". The rule should
> not be merely "doesn't alter any data members of this object" but rather
> "does not alter observable state of this object or vend any type of pointer
> or reference by which observable state of this object could be altered".
>

Precisely!

Because this is subtle, and can't be completely checked by a compiler,
people can often get it wrong.  Used correctly, though, const is a powerful
tool for enforcing correct API usage, allowing optimizations, and informing
readers of a class' contract and functionality.  Reviewers should understand
and consider these sorts of details.

PK
_______________________________________________
webkit-dev mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

Reply via email to