Skip to content

[SUGGESTION] if (i==j) gives clang warning about (i==j) #632

Closed Answered by JohelEGP
realgdman asked this question in Q&A
Discussion options

You must be logged in to vote

You're right.
It's only if a = b that's rejected.
if (a = b) isn't.
Because the grammar is 'if' logical-or-expression.

So only if (a == b) don't need the redundant parentheses lowered to Cpp1 to avoid warnings.
Or maybe it's good that they're lowered to Cpp1 as-is,
because it means, "hey, you used redundant parentheses in Cpp2!"

Replies: 6 comments

This comment has been hidden.

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by hsutter
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants
Converted from issue

This discussion was converted from issue #457 on August 30, 2023 18:50.