C++ Logo

std-proposals

Advanced search

Re: [std-proposals] if !(condition)

From: Tiago Freire <tmiguelf_at_[hidden]>
Date: Sat, 20 Apr 2024 18:33:10 +0000
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_at_[hidden]> On Behalf Of Yexuan Xiao via Std-Proposals
Sent: Saturday, April 20, 2024 18:10
To: std-proposals_at_[hidden]
Cc: Yexuan Xiao <bizwen_at_[hidden]>
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.

Received on 2024-04-20 18:33:14