-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
While looking into addressing the following warning:
tmp/DTIPrep/src/IntensityMotionCheckPanel.cxx: In member function ‘void IntensityMotionCheckPanel::ResultUpdate()’:
/tmp/DTIPrep/src/IntensityMotionCheckPanel.cxx:3978:33: warning: suggest parentheses around operand of ‘!’ or change ‘&’ to ‘&&’ or ‘!’ to ‘~’ [-Wparentheses]
if( ( ( (!qcResult.Get_result() & InterlaceWiseCheckBit) == InterlaceWiseCheckBit ) ||
^
associated with this code:
DTIPrep/src/IntensityMotionCheckPanel.cxx
Lines 3979 to 3983 in d764409
| if( ( ( (!qcResult.Get_result() & InterlaceWiseCheckBit) == InterlaceWiseCheckBit ) || | |
| (!(this->GetProtocol().GetSliceCheckProtocol().bQuitOnCheckFailure || | |
| this->GetProtocol().GetInterlaceCheckProtocol().bQuitOnCheckFailure) ) ) && | |
| this->GetProtocol().GetGradientCheckProtocol().bCheck ) | |
| { |
I suspect something is wrong.
Indeed, based on the operator precedence [1], adding parenthesis around !qcResult.Get_result() is the right thing to do to address the warning, that said the check should be reviewed since the value returned by Get_result() always evaluates to 1 or 0.
[1] http://en.cppreference.com/w/c/language/operator_precedence
Looking at this test in an other part of the code hints on what should be the correct implementation:
DTIPrep/src/IntensityMotionCheckPanel.cxx
Lines 4245 to 4248 in d764409
| if( ( (!( (qcResult.Get_result() & InterlaceWiseCheckBit) == InterlaceWiseCheckBit) ) || | |
| (!(this->GetProtocol().GetSliceCheckProtocol().bQuitOnCheckFailure || | |
| this->GetProtocol().GetInterlaceCheckProtocol().bQuitOnCheckFailure) ) ) ) | |
| { |
Metadata
Metadata
Assignees
Labels
No labels