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

Use nullptr #447

Merged
merged 2 commits into from
Feb 15, 2020
Merged

Conversation

matthew-reynolds
Copy link
Member

Part of ros-controls/ros_control#403. Corresponds to ros-controls/ros_control#405.

Use nullptr instead of 0 or NULL for null pointers.

Note: ackermann_steering_controller.cpp and diff_drive_controller.cpp contain the following snippet:

if (!link)
{
 ROS_ERROR("Link == NULL.");
  return false;
}

Here, I did not change the NULL to nullptr since it's in a string. Would you like this updated as well? "Link == nullptr" or perhaps "Link pointer is null"?

@bmagyar
Copy link
Member

bmagyar commented Jan 26, 2020

Let's make the above snippet print a more informative message. The rest of the PR looks good to me!

@matthew-reynolds
Copy link
Member Author

Updated to "Link pointer is null." This isn't that much more informative, but additional information is given the surrounding context, and this is at least more human-friendly to read.

Copy link
Member

@bmagyar bmagyar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@bmagyar bmagyar merged commit 735294a into ros-controls:melodic-devel Feb 15, 2020
@matthew-reynolds matthew-reynolds deleted the use-nullptr branch February 16, 2020 14:14
alcantara09 pushed a commit to alcantara09/ros_controllers that referenced this pull request May 12, 2021
* Prefer nullptr for null pointers
* Update null link pointer error message
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.

None yet

2 participants