mercredi 31 mai 2017

When does C++11 give warnings about operator precedence?

When writing code, for a long time I knew that && has higher precedence than ||; however, compiling it using the C++11 standard gave me a warning that I should now use parentheses when using both in a single statement.

Now I got a warning that combining >> and + also should have parentheses. Now my statements look really ugly, with 5 or more parentheses floating around them.

1) Is there a resource that says which combinations of operators now require parentheses?

2) Is there a way to silence just the operator precedence warnings, but to keep the other warnings?

Compiler gcc with flags -O2 -Wall -g

The warnings came in when I added the flag -std=c++11

Aucun commentaire:

Enregistrer un commentaire