Hi all, In working on upgrading our C++ support to C++17 [1], we've run into some issues [2] surrounding the newly-introduced `std::byte` [3], various Microsoft headers that pull in definitions of `byte`, and conflicts between the two when one has done `using namespace std;`, particularly at global scope. Any use of `using namespace $NAME` is not permitted by the style guide [4].
A quick perusal of our code shows that we have, uh, "many" violations of the prohibition of `using namespace $NAME` [5]. I do not intend to boil the ocean and completely rewrite our codebase to eliminate all such violations. However, since the use of `using namespace std;` is relatively less common (~100 files) and is blocking useful work, eliminating that pattern seems like a reasonable thing to do. Thus far, it appears that the problematic `using namespace std;` instances all appear at global scope. We have a handful of function-scoped ones that do not appear to be causing problems; if those are easy to remove in passing, we'll go ahead and remove function-scoped ones as well. The intent is to not apply this change to third-party code unless absolutely necessary; we have various ways of dealing with the aforementioned issues--if they even come up--in third-party code. The work is being tracked in [2]. Please do not add new instances of `using namespace std;` at global scope, or approve new instances in patches that you review; when this work is complete, we will ideally have a lint that checks for this sort of thing automatically. If you would like to help with this project, please file blocking bugs against [2]. Thanks, -Nathan [1] https://bugzilla.mozilla.org/show_bug.cgi?id=1560664 [2] https://bugzilla.mozilla.org/show_bug.cgi?id=1577319 [3] http://eel.is/c++draft/cstddef.syn#lib:byte [4] https://google.github.io/styleguide/cppguide.html#Namespaces [5] https://searchfox.org/mozilla-central/search?q=using+namespace+.%2B%3B&case=false®exp=true&path= _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform