C++ Logo

std-proposals

Advanced search

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

From: Andrew Tomazos <andrewtomazos_at_[hidden]>
Date: Sun, 21 Apr 2024 08:23:35 +1000
Jens,

I see. So you want to search for `if (!(`

That is 668735 so:

16.5% of if statements are like `if (!expr)`

1.4% of if statements are like `if(!(expr))` (or about 10% of `if(!expr)`
statements)

The numbers given by the author were originally referring
> to this case, and, given those numbers, I'm not seeing this
> as a frequent enough situation to warrant the extra syntax.
>

Got it. Yeah I agree with the ~1% you are seeing.

Note that
>
> if (! (a && b) || c)
>
> can't become
>
> if ! (a && b || c)
>

yeah and neither can:

   if (!(T) foo)

I checked that occurrences of `if(!` were dominated by `if(!expr)`. I
lightly checked the same is true for `if(!(` and `if(!(expr))`, confident
that its 80%+ at least.


> > PS (`if(`=7495313 / `if(!`=45254716) in ACTCD19
>
> These numbers feel swapped.
>

Yup. Typo, other way around.

Received on 2024-04-20 22:23:47