Closed VictorLamoine closed 6 years ago
Pull request to remove the warning from MoveIt is here: https://github.com/ros-planning/moveit/pull/849
@VictorLamoine I'll go through these and test/merge after work today.
Additionally, @VictorLamoine I got the sense of what you're trying to do from the Discourse page. Can you share URDF models & perhaps tool paths with me, either in public or privately via email? I would like to help where I can get you setup on the right foot.
I'll make a public repository with a simple setup but it's going to take some time as I have plenty to do :) I will ping you when it is ready!
My MoveIt merge request has been merged.
Tell me if you want me to remove the -Wall -Wextra
compile flags on the packages.
I'm okay with all the changes except maybe the ones in SparsePlanner
. I always welcome stuff being built with all possible, relevant warnings.
I rebased against current master and I fixed the problem with findNearestSparsePointIndex
and getDensePointIndex
@VictorLamoine I'm in an uncomfortable situation because I don't have any real tests with respect to the code in sparse planner specifically and I'm not sure if it works now much less after the changes you made. The original author does not have time to look at it. So:
sparse_planner.cpp
alone and suppress warnings about uint/int comparisons, OR...size()
to int, instead of moving ints to unsigned).I hate to be annoying, but this is my request to you on this one. Given this codes status, I'm inclined to mark it deprecated and remove it in the future unless there is someone who is willing to take on the burden on maintenance.
Just wanted to also chime in to mention my impression is that current C++ wisdom seems to be to move away from unsigned types. E.g., the google style guide:
You should not use the unsigned integer types such as uint32_t, unless there is a valid reason such as representing a bit pattern rather than a number, or you need defined overflow modulo 2^N. In particular, do not use unsigned types to say a number will never be negative. Instead, use assertions for this.
and
The best advice we can provide: try to use iterators and containers rather than pointers and sizes, try not to mix signedness, and try to avoid unsigned types (except for representing bitfields or modular arithmetic). Do not use an unsigned type merely to assert that a variable is non-negative.
So it's probably best to not let unsignedness spread through the program, even if it happens to be needed locally in a for
loop.
I'm not sure Google style guide is a reference...! The C++11 standards states that an array or std container index must be a std::size_t
, it is the only safe and portable way to index arrays. Anything else is either unsafe, not portable or both.
@Jmeyer1292 that is exactly where automated tests would have been very helpful :smiley:
I'll revert the changes in the sparse_planner
and create an other WIP pull request with the very same modifications.
PR updated, it fixes the warnings for everything but descartes_planner
package, I disabled the warnings in this package because they are not fixed.
@Jmeyer1292 do not hesitate to ask me to do some modifications if there is anything you don't like.
@VictorLamoine Thanks for your patience with us.
-Wall
and-Wextra
flagsThis warning comes from MoveIt, I'll make a pull request to fix this issue, this bloats compilation logs when using warnings:
Main issues fixed:
std::size_t
solves them allTo be done before merging: