[webkit-dev] Unified source builds: A new rule for static variables
Keith Miller
keith_miller at apple.com
Tue Aug 29 09:12:14 PDT 2017
> On Aug 29, 2017, at 9:04 AM, Chris Dumez <cdumez at apple.com> wrote:
>
> I indeed think this will require “using” statements or explicit namespace at call sites.
Yeah, this is basically what’s required. Unfortunately, if you ‘using namespace’ in a namespace all subsequent copies of that namespace will also see the ‘using’. e.g.
namespace Foo {
namespace Bar {
int myVar { 0 };
}
using namespace Bar;
}
namespace Foo {
namespace Baz {
int myVar { 0 };
}
using namespace Baz;
int myFunction() { return myVar; }
}
Will fail since myVar could be Baz::myVar or Bar::myVar. Using ‘using namespace’ inside a function or class body should be fine however.
>
> I don’t think anonymous namespaces are suitable for resolving naming conflicts due to unity builds since the functions and up in the same compilation unit.
That’s right.
>
> --
> Chris Dumez
>
>
>
>
>> On Aug 29, 2017, at 9:00 AM, Darin Adler <darin at apple.com <mailto:darin at apple.com>> wrote:
>>
>> How does this work? Without a “using” how does it know to search this namespace? Is this superior to using anonymous namespaces instead of “static”?
>>
>> — Darin
>> _______________________________________________
>> webkit-dev mailing list
>> webkit-dev at lists.webkit.org <mailto:webkit-dev at lists.webkit.org>
>> https://lists.webkit.org/mailman/listinfo/webkit-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20170829/9aa041ae/attachment.html>
More information about the webkit-dev
mailing list