Why does intpromote spew warnings for ~ operator?

Steven Schveighoffer schveiguy at gmail.com
Thu Sep 16 18:03:49 UTC 2021


On 9/15/21 11:58 PM, Walter Bright wrote:
> On 9/13/2021 1:35 PM, Steven Schveighoffer wrote:
>> To reiterate, intpromote is going to require lots of casts, most of 
>> which wouldn't change any behavior that is currently happening.
> 
> Intpromote has been there for many years, it hasn't caused a big problem.

It's clear that you aren't going to budge at all on this, but just to 
respond to this -- `-preview=intpromote` is *not* required. It's not a 
default, and it's not used by default in dub. People are complaining 
about the excessive casting recommended by the compiler, even though 
their code works as expected now, and would work as expected after 
intpromote is the default.

> It needs to move to C behavior.

In C:

```c
unsigned short a2 = ~a1;
```

is valid. Why are we not continuing to replicate that behavior?

-Steve


More information about the Digitalmars-d mailing list