public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "alexis.menard at openbossa dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/48891] std functions conflicts with C functions when building with c++0x support (and using namespace std) Date: Thu, 05 May 2011 22:22:00 -0000 [thread overview] Message-ID: <bug-48891-4-anNVROHoRk@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-48891-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48891 --- Comment #3 from Alexis Menard <alexis.menard at openbossa dot org> 2011-05-05 22:17:36 UTC --- (In reply to comment #2) > (In reply to comment #0) > > > > and build it with : g++ main.cpp -std=c++0x -std=gnu++0x -o test > > There's no point specifying two -std options, only the last one takes effect. > > > If I deactivate the c++0x support it works. > > Because in C++98 there is no std::isnan, so you only get the version in the > global namespace from <math.h> That explain. > > > The real issue is that the c++0x standard removes the prohibition on C++ > > headers declaring C names in the global namespace. The problem here is that > > math.h is included therefore the declarations are in the global namespace. > > I don't think that's the problem, because libstdc++ has always declared the > names in the global namespace even though it wasn't valid in C++03 - we haven't > changed that for C++0x (all that happened is the standard was relaxed to > reflect the reality of actual implementations) > Sorry for my ignorance. > > > I'm not really sure how the compiler can solve that but this new "feature" of > > c++0x seems to be very annoying. I could solve it by not using namespace std > > but let say the project is huge, it will requires lot of modifications. > > > > Basically any time you use using namespace std, you may have conflicts with the > > underlaying C libraries, it's even more annoying with your own namespace > > because your functions can conflict with all the stuff in the global namespace > > put by C libraries and it's very common in a cpp file to use "using namespace > > foo;" > > > > Any suggestions on how I could "workaround" that? > > Qualify isnan explicitly, by calling either ::isnan or std::isnan Well that requires me to modify my entire project, namely WebKit :(. But the more I'm stuck on that issue, the more it seems to be the only solution.
next prev parent reply other threads:[~2011-05-05 22:22 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-05-05 21:50 [Bug libstdc++/48891] New: std functions conflicts with C functions when building with c++0x support alexis.menard at openbossa dot org 2011-05-05 21:44 ` [Bug libstdc++/48891] " alexis.menard at openbossa dot org 2011-05-05 22:08 ` [Bug libstdc++/48891] std functions conflicts with C functions when building with c++0x support (and using namespace std) redi at gcc dot gnu.org 2011-05-05 22:22 ` alexis.menard at openbossa dot org [this message] 2011-05-05 22:47 ` paolo.carlini at oracle dot com 2011-05-05 23:16 ` paolo.carlini at oracle dot com 2012-04-29 13:17 ` marc.glisse at normalesup dot org 2015-04-09 14:35 ` redi at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-48891-4-anNVROHoRk@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).