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

Replaced zero with NULL for null pointer constants #14

Merged

Conversation

marting87
Copy link
Contributor

When using ROS_INFO, ROS_WARN and ROS_ERROR the warning -Wzero-as-null-pointer-constant is triggered in code that is compiled with c++11.

#define NULL 0
//since C++11
#define NULL nullptr

As of gcc 4.7 and clang 5.0 the compiler will trigger a warning if 0 is used instead of nullptr in c++11.

Replaced 0 with NULL to be compatible c++11+ and prior versions.

@dirk-thomas
Copy link
Member

Thank you for the improvement.

@dirk-thomas dirk-thomas merged commit 1f0a73a into ros:melodic-devel Aug 15, 2018
@gavanderhoorn
Copy link
Contributor

@dirk-thomas: would this PR be considered for a backport to kinetic-devel (still at ros_comm I believe?)? Kinetic also targets C++11 and this also leads to these errors shown there.

@dirk-thomas
Copy link
Member

I don't think that addressing compiler warnings is important enough to backport. If you would like to create a PR for it I can certainly merge it.

gavanderhoorn added a commit to gavanderhoorn/ros_comm that referenced this pull request Jun 18, 2019
But use `NULL`, which will evaluate to `nullptr` on platforms where appropriate and `0` elsewhere.

Identical to ros/rosconsole#14.
@gavanderhoorn
Copy link
Contributor

See: ros/ros_comm#1730.

dirk-thomas pushed a commit to ros/ros_comm that referenced this pull request Oct 3, 2019
But use `NULL`, which will evaluate to `nullptr` on platforms where appropriate and `0` elsewhere.

Identical to ros/rosconsole#14.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants