Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert 0 to nullptr #91

Closed
mfeemster opened this issue Mar 14, 2016 · 4 comments
Closed

Convert 0 to nullptr #91

mfeemster opened this issue Mar 14, 2016 · 4 comments
Labels

Comments

@mfeemster
Copy link

If you compile pugixml with this option enabled in gcc: -Wzero-as-null-pointer-constant

There are a ton of warnings. You should probably move to C++11 style and use nullptr instead of 0 for pointers.

Thanks.

@zeux
Copy link
Owner

zeux commented Mar 15, 2016

Why do you need to compile pugixml with Wzero-as-null-pointer-constant?

@mfeemster
Copy link
Author

I don't need to, it's just that I usually have that option turned on. It's really just a matter if you want to have the code base be fully C++11 compliant. If not, disregard this issue.

@zeux
Copy link
Owner

zeux commented Apr 3, 2016

As far as I know, being fully C++11 compliant does not require using nullptr instead of 0. The gcc warning is more like a "style" warning, similar to some other warnings that aren't unambiguously good...

There are two small practical issues with using nullptr in pugixml:

  • pugixml is not a C++11 codebase - it supports lots of compilers that predate C++11. So just using nullptr will break compatibility for a lot of users. This should be fixable by defining nullptr as 0 if compiler does not support nullptr natively, hopefully.
  • The development environment I use does not support the warning, so there's some chance of breaking this from time to time. This seems to be fixable by relying on CI results though, since Travis CI uses gcc-4.8.4 which should have this warning.

@mfeemster
Copy link
Author

You're correct, it's just stylistic and doesn't add anything. I'll close this issue. Thanks.

@zeux zeux added the wontfix label Apr 15, 2017
jhasse added a commit to jhasse/pugixml that referenced this issue May 10, 2020
zeux added a commit that referenced this issue May 11, 2020
Use nullptr in pugixml.hpp if available, see #91
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants