[webkit-dev] Style guide should mention that we don't use anonymous namespace

Ryosuke Niwa rniwa at webkit.org
Wed Oct 19 15:52:39 PDT 2011


I'm interested in learning the existing convention, not reasons to prefer
one or another.

- Ryosuke

On Wed, Oct 19, 2011 at 3:50 PM, John Knottenbelt <jknotten at chromium.org>wrote:

> I would recommend wrapping such classes in an anonymous namespace to avoid
> surprising link errors due to unintentional name collision. Such problems
> can also be difficult to spot at first as sometimes the linker "just" works
> and then you get a seg fault sometime later.
>
> On Wed, Oct 19, 2011 at 3:47 PM, Ryosuke Niwa <rniwa at webkit.org> wrote:
>
>> How about classes that are only used in one cpp file? Should we be
>> wrapping those in an anonymous namespace?
>>
>> - Ryosuke
>>
>>
>> On Wed, Oct 19, 2011 at 3:45 PM, Darin Adler <darin at apple.com> wrote:
>>
>>> The guideline is not to disallow anonymous namespaces.
>>>
>>> It’s to prefer “static” over anonymous namespaces when either one would
>>> work.
>>>
>>> Debugging tools on at least some of the platforms work better with
>>> functions that are given internal linkage by using the “static” keyword
>>> rather than functions that are inside anonymous namespaces.
>>>
>>> On the other hand, anonymous namespaces are a more powerful tool that can
>>> do more than the “static” keyword can.
>>>
>>>    -- Darin
>>>
>>>
>>
>> _______________________________________________
>> webkit-dev mailing list
>> webkit-dev at lists.webkit.org
>> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20111019/b0be4ac6/attachment.html>


More information about the webkit-dev mailing list