[webkit-dev] Using C++ constant pointers (type_name * const) in WebKit

Peter Kasting pkasting at chromium.org
Mon Nov 28 14:10:39 PST 2011


On Mon, Nov 28, 2011 at 1:38 PM, David Kilzer <ddkilzer at webkit.org> wrote:

> In a discussion on Bug 71921<https://bugs.webkit.org/show_bug.cgi?id=71921>,
> Antti, Darin Adler and I started a discussion about using C++ constant
> pointers in WebKit.  Does the WebKit community have a consensus opinion on
> the matter?
>

It seems like the const in "T * const idName" is equally useful (or
useless) to the const in "const T idName".  Both are saying that |idName|
(as opposed to what it points to, in the first case) is constant.  In both
cases people are rarely in that habit of using const, especially when
|idName| is a local.  The same pros and cons seem to apply to both.
 Therefore I would suggest that if we want to make a rule, we make it apply
to both cases.

I personally like using const as much as possible (without overstepping
logical constness limits), but I also suspect my view is the minority.

PK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20111128/d17014ab/attachment.html>


More information about the webkit-dev mailing list