This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/51749] Including <algorithm> pollutes global namespace


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]