This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/51749] Including <algorithm> pollutes global namespace
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 17 Jan 2012 11:37:34 +0000
- Subject: [Bug libstdc++/51749] Including <algorithm> pollutes global namespace
- Auto-submitted: auto-generated
- References: <bug-51749-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51749
--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-01-17 11:37:34 UTC ---
(In reply to comment #7)
> If not, it sounds like something that can fixed just by wrapping the #include
> in a namespace std block.
That could never work.
1) namespace are ignored for extern "C" functions
2) if you also surrounded them in extern "C++" that would cause your program to
see a declaration of extern "C++" std::puts(const char*), which would not be
found in libc.so because that contains a definition for extern "C" puts.
3) as Paolo said, it's legal anyway