[webkit-dev] Style question: static, protected, or public members
Jeremy Orlow
jorlow at chromium.org
Tue May 25 02:21:13 PDT 2010
On Tue, May 25, 2010 at 12:19 AM, Darin Adler <darin at apple.com> wrote:
> On May 20, 2010, at 8:54 PM, TAMURA, Kent wrote:
>
> > What's the naming rule for non-const static members?
> >
> > Some classes give "s_" prefixes:
> > WebCore/page/DOMTimer.h: static double s_minTimerInterval;
> > WebCore/page/GeolocationPositionCache.h: static int s_instances;
> >
> > FrameView gives "s" prefix:
> > WebCore/page/FrameView.h: static double sCurrentPaintTimeStamp; //
> used for detecting decoded resource thrash in the cache
> >
> > Settings gives "g" prefix:
> > WebCore/page/Settings.h: static bool gShouldPaintNativeControls;
> > WebCore/page/Settings.h: static bool
> gShouldUseHighResolutionTimers;
>
> If we have to use a prefix for this, I suggest the "s_" prefix.
>
> > And what about public and protected members? The style guide has no
> exceptions for them, so I think they should have m_. But many classes in
> WebCore don't use m_ for public members.
>
> Generally speaking I suggest we do not use the "m_" prefix for the members
> of structs. And I suggest that classes with public data members be structs
> instead of classes. Classes that have public data members only for
> historical reasons should be changed so the data members are not public. We
> should talk some specific examples.
>
+1 to the proposal
In case this is what we decide upon, I've created a patch to update our
coding style page [1]. (I'm also happy to roll another if someone has a
better suggestion.)
[1] https://bugs.webkit.org/show_bug.cgi?id=39663
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20100525/383456df/attachment.html>
More information about the webkit-dev
mailing list