[webkit-dev] Style question: static, protected, or public members

Jeremy Orlow jorlow at chromium.org
Sun Jun 13 14:56:07 PDT 2010


On Sun, Jun 13, 2010 at 12:46 AM, Maciej Stachowiak <mjs at apple.com> wrote:

>
> On Jun 4, 2010, at 3:54 PM, Joe Mason wrote:
>
> > I'm strongly in favour of g_.  It seems weird and ugly to me to have
> > prefixes for some non-local scopes but not all.  And it's very helpful
> > to be able to look at a variable reference and immediately know that
> > it's a global, and not a local whose definition you skimmed over.
>
> I think file-scope static globals don't need a prefix. In the few cases of
> globals with extern linkage, I think a prefix would make them needlessly
> unpleasant to use. HTMLNames.h is one of the most prominent examples. I
> don't think we'd want to write g_divTag and g_widthAttr instead of divTag
> and widthAttr.
>

For what it's worth, I think having a special prefix has benefits beyond
conflicts when linking.  I agree 100% with what Joe said.

(That said: if there isn't a lot of support for this, I don't think anything
should change...but I figured I'd throw it out there in case others agreed.)

J
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20100613/04647259/attachment.html>


More information about the webkit-dev mailing list