I completely understand if you think this issue is too minor, but the libc++ example demonstrates that it eliminates some operator precedence issues, and the previous proposal P1181 was invented with different motivations, which might change your perspective.

With C++23 introducing if ! consteval, I believe it’s appropriate to introduce ! to regular if statements, as it doesn’t sacrifice consistency.

From: Tiago Freire <tmiguelf@hotmail.com>
Sent: Sunday, April 21, 2024 2:33
To: std-proposals@lists.isocpp.org <std-proposals@lists.isocpp.org>
Cc: Yexuan Xiao <bizwen@nykz.org>
Subject: RE: if !(condition)
 

My opinion on this is that it is too small to matter.

The only use case is, when you have a whole negation of the condition and that is the only branch, it doesn’t allow you to do anything that you can’t already do as it is.

It sacrifices a little bit of syntax consistency and the only thing you get in return is to save 2 parentheses.

Doesn’t look like it could harm, but also doesn’t look like it does much for me either. It’s a big meh.

That the pattern if(!()) occurs often doesn’t convince me as sufficient reason.

My 2c

 

From: Std-Proposals <std-proposals-bounces@lists.isocpp.org> On Behalf Of Yexuan Xiao via Std-Proposals
Sent: Saturday, April 20, 2024 18:10
To: std-proposals@lists.isocpp.org
Cc: Yexuan Xiao <bizwen@nykz.org>
Subject: [std-proposals] if !(condition)

 

I've wrote a proposal that suggests allowing the omission of the outermost parentheses to simplify the conditions in if statements:

https://storage.nykz.org/proposals/if-not/

 

Please share your comments.