ros / rosconsole

17 stars 61 forks source link

Replaced zero with NULL for null pointer constants #14

Closed marting87 closed 6 years ago

marting87 commented 6 years ago

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 commented 6 years ago

Thank you for the improvement.

gavanderhoorn commented 5 years ago

@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 commented 5 years ago

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 commented 5 years ago

See: https://github.com/ros/ros_comm/pull/1730.