Skip to content

DisplVertices - Fix abs( bool expression ) bug

Whilst fixing a number of trivial clang warnings in master in !1364 (merged) I stumbled over the bug here. By the looks of it, a real physics bug. The abs( ) should clearly be applied to the value rather than the boolean result of the comparison.

On the face of it this would have a real impact on the selection, i.e. with the bug it was asymmetrically applied ?

@nskidmor @cvazquez FYI I'll leave it to you to decide if you want this in other stripping branches.

Side comment, but this goes to prove why its important to keep the builds clean, for all compilers, in the nightlies, as this was hidden amongst a bunch of other trivial clang warnings, and gcc did not complain about it...

Phys/DisplVertices/src/DisplVertices.cpp:1057:14: warning: taking the absolute value of unsigned type 'bool' has no effect [-Wabsolute-value]
    else if( abs(pv->position().x()>1.5*mm) || abs(pv->position().y()>1.5*mm)){

Merge request reports