<div dir="ltr">That's a good point.  Since mutex is a new c++11 feature, why is it injected into the std namespace when not compiling with c++11.  I looked at the mutex header, and it doesn't test current value of __cplusplus.  <div><br></div><div>Should it?</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 29, 2016 at 3:07 PM, Jim Porter via cfe-users <span dir="ltr"><<a href="mailto:cfe-users@lists.llvm.org" target="_blank">cfe-users@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 2/29/2016 12:15 PM, Brian Cole via cfe-users wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Was hoping for something that would be C++03 compatible as well since we<br>
still have C++03 compilers to target as well.<br>
</blockquote>
<br></span>
If you're #including <mutex>, haven't you locked yourself into C++11 (or better) anyway? In that case, you should use curly braces for your initializer (or at least stop saying `using namespace std;`).<br>
<br>
For existing code where `mutex` is a global variable, you'll be fine. If you add<span class=""><br>
<br>
  #include <mutex><br>
  using namespace std;<br>
<br></span>
to existing code, you'll get a compiler error because the name `mutex` is now ambiguous.<br>
<br>
If you wanted to warn about this in *all* cases, you'd need an additional warning to detect function declarations in local scope, since that's what C++ would treat this as. Clang doesn't have such a warning, but perhaps you could convince someone to add it.<br>
<br>
- Jim<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
_______________________________________________<br>
cfe-users mailing list<br>
<a href="mailto:cfe-users@lists.llvm.org" target="_blank">cfe-users@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users</a><br>
</div></div></blockquote></div><br></div>