I converted some Fortran code to C. I was wondering if someone could help me solve the following problem:
warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
I know this warning is caused by syntax like this:
A || B && C
Which should be written as:
A || (B && C)
My compiler is able to compile the code since && has a higher priority than || so it just imagines the parentheses.
The problem is that this warning occurs about 30.000 times since I'm working on a large project.
Is there any tool that is able to insert the parenthesis around all the && automatically?
As others have said do it manually, also you can disable this warning using -Wno-parentheses
, even though that's pretty dangerous
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With