On Thu, May 8, 2014 at 9:11 AM, John Peterson <jwpeter...@gmail.com> wrote:

>
>
>
> On Thu, May 8, 2014 at 8:24 AM, Michael Povolotskyi 
> <mpovo...@purdue.edu>wrote:
>
>> Hello everybody,
>>
>> In a file parallel_implementation.h there are lines:
>> 173 // Anonymous namespace for helper functions
>> 174 namespace {
>> 175
>> 176 // Safe to use this here since it won't "infect" anything outside the
>> 177 // anonymous namespace
>> 178 using namespace libMesh;
>> 179
>>
>> However,
>> the following resource
>>
>> http://stackoverflow.com/questions/8775563/using-namespace-statement-inside-an-anonymous-namespace
>>
>> tells that that "using" inside an anonymous namespace is not safe.
>>
>
> I tried the same thing but with 2 separate files:
>
> // X.h
> namespace X
> {
> int f() { return 1; }
> }
>
> // Anonymous namespace with using declaration inside
> namespace
> {
> using namespace X;
> }
>
>
> // main.C
> #include "X.h"
>
> int main()
> {
>   // Does the 'using' declaration apply to us?
>   f();
>
>    return 0;
> }
>
> and it compiles for me, so it seems that the using declaration inside an
> anonymous namespace does still pollute the namespace of any file that
> includes it, Roy's comment notwithstanding...
>
> This should be pretty easy to fix though, I'll push a patch hopefully
> shortly, that does that.
>

OK, I pushed a fix to the 'namespace' branch on github.

In case you are not using git, I also attached a patch directly to this
email if you'd like to try that and see if it fixes the issue.

-- 
John
------------------------------------------------------------------------------
Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
&#149; 3 signs your SCM is hindering your productivity
&#149; Requirements for releasing software faster
&#149; Expert tips and advice for migrating your SCM now
http://p.sf.net/sfu/perforce
_______________________________________________
Libmesh-users mailing list
Libmesh-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to