On Thu, Jun 9, 2011 at 3:51 PM, Maciej Stachowiak <m...@apple.com> wrote:

> In principle, the return value could have been retrieved from a container
> that the immediate callee only has a const reference to. So then casting
> away const on the return value would be a hazard.
>

You're right; if the implementation of the const function accesses other
objects besides |this|, it might be better to re-implement the non-const
function rather than simply casting, so the compiler can at least check
those accesses.  This implies that in general we'd want to limit function
pairs to accessors with fairly simple implementations, and only make
exceptions where there's real value, lest the maintenance burden and bug
surface outweigh any gain from providing caller const convenience.

I'll try to keep this in mind before I try posting any patches that split
accessors into pairs.

PK
_______________________________________________
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

Reply via email to