[webkit-dev] Using C++ constant local variables in WebKit

Ryosuke Niwa rniwa at webkit.org
Tue Nov 29 18:44:34 PST 2011


On Tue, Nov 29, 2011 at 6:42 PM, Ryosuke Niwa <rniwa at webkit.org> wrote:
>
>    - Prevents misuse of variable in a later patch (by a different author)
>> through enforcement of const-ness.
>>
>>
>> Prevents one specific type of misuse: Setting the variable to another
>> value. And that may not be misuse despite the fact that the original author
>> didn’t plan on changing it.
>>
>
> Right, but it tells us the intent of the author, and appears to be useful
> even if the variable started with prefixes like "old", "original", and
> "previous".
>

I'll add that I'd much prefer seeing a const in front of a local variable
over seeing a comment like "This variable shouldn't be modified".

- Ryosuke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20111129/05cc809b/attachment.html>


More information about the webkit-dev mailing list