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

filter_base.hpp: use unsigned long instead of size_t in getParam 2nd … #39

Open
wants to merge 1 commit into
base: ros2
Choose a base branch
from

Conversation

shr-project
Copy link

…parameter

  • it was added in:
    25c7d30
    but unfortunately on 32bit systems size_t could be the same as unsigned int already
    defined above and then the build fails with:

| filters/2.0.0-1-r0/git/include/filters/filter_base.hpp:219:8: error: 'bool filters::FilterBase::getParam(const string&, size_t&)' cannot be overloaded with 'bool filters::FilterBase::getParam(const string&, unsigned int&)'
| 219 | bool getParam(const std::string & name, size_t & value)
| | ^~~~~~~~
| filters/2.0.0-1-r0/git/include/filters/filter_base.hpp:201:8: note: previous declaration 'bool filters::FilterBase::getParam(const string&, unsigned int&)'
| 201 | bool getParam(const std::string & name, unsigned int & value)
| | ^~~~~~

  • using unsigned long works on both 32bit and 64bit systems I've tried

Signed-off-by: Martin Jansa [email protected]

@jonbinney
Copy link
Contributor

This seems reasonable to me. @shr-project could you rebaseon top of the current ros2 branch? I've fixed the tests now so we can make sure they pass for this PR.

…parameter

* it was added in:
  ros@25c7d30
  but unfortunately on 32bit systems size_t could be the same as unsigned int already
  defined above and then the build fails with:

| filters/2.0.0-1-r0/git/include/filters/filter_base.hpp:219:8: error: 'bool filters::FilterBase<T>::getParam(const string&, size_t&)' cannot be overloaded with 'bool filters::FilterBase<T>::getParam(const string&, unsigned int&)'
|   219 |   bool getParam(const std::string & name, size_t & value)
|       |        ^~~~~~~~
| filters/2.0.0-1-r0/git/include/filters/filter_base.hpp:201:8: note: previous declaration 'bool filters::FilterBase<T>::getParam(const string&, unsigned int&)'
|   201 |   bool getParam(const std::string & name, unsigned int & value)
|       |        ^~~~~~

Signed-off-by: Martin Jansa <[email protected]>
@jonbinney
Copy link
Contributor

@shr-project looks like the linter prefers explicitly sized types, could you switch to that? Here is the error from the linter:

/tmp/ws/src/filters/include/filters/filter_base.hpp:219:  Use int16/int64/etc, rather than the C type long  [runtime/int] [4]

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.

2 participants