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.