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

Fix a comparison with a sign mismatch #771

Merged
merged 1 commit into from
Jun 26, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rclcpp/src/rclcpp/node_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ NodeOptions::get_rcl_node_options() const
}
}

if (this->arguments_.size() > std::numeric_limits<int>::max()) {
if (this->arguments_.size() > static_cast<size_t>(std::numeric_limits<int>::max())) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't std::numeric_limits<size_t>::max() make more sense?

Copy link
Member Author

Choose a reason for hiding this comment

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

The guard is for the signature of rcl_parse_arguments, which accepts an int type:

https://github.com/ros2/rcl/blob/b6f4bc97faf34dd85f7acff7cb27945cfe438369/rcl/include/rcl/arguments.h#L91-L98

throw_from_rcl_error(RCL_RET_INVALID_ARGUMENT, "Too many args");
}

Expand Down