You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like there are two cases of performing an assignment instead of equality check inside assertions:
algorithms/validation/choose_ETA.cpp:931:
assert(current_delta_rank = nb_var + 1);
algorithms/validation/choose_ETA.cpp:999:
assert(current_delta_rank = nb_var + 1);
I stumbled upon those thanks to compiler warnigs (compilation using g++ 11.2.0):
algorithms/validation/choose_ETA.cpp: In function ‘vroom::Route vroom::validation::choose_ETA(const vroom::Input&, unsigned int, const std::vector<vroom::VehicleStep>&)’:
algorithms/validation/choose_ETA.cpp:931:29: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
931 | assert(current_delta_rank = nb_var + 1);
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
algorithms/validation/choose_ETA.cpp:999:29: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
999 | assert(current_delta_rank = nb_var + 1);
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
Both current_delta_rank and nb_var are of type unsigned, and the assertions can only fail in case of wrap-around. Is this intended? I guess not, if only for the side effects of the assignment missing if compiling with NDEBUG.
I can send a PR that changes assignment to equality check, but I'm afraid I have no means to test this properly.
The text was updated successfully, but these errors were encountered:
It looks like there are two cases of performing an assignment instead of equality check inside assertions:
I stumbled upon those thanks to compiler warnigs (compilation using g++ 11.2.0):
Both
current_delta_rank
andnb_var
are of typeunsigned
, and the assertions can only fail in case of wrap-around. Is this intended? I guess not, if only for the side effects of the assignment missing if compiling withNDEBUG
.I can send a PR that changes assignment to equality check, but I'm afraid I have no means to test this properly.
The text was updated successfully, but these errors were encountered: