Why does intpromote spew warnings for ~ operator?

Alexey invalid at email.address
Tue Sep 14 09:07:24 UTC 2021


On Tuesday, 14 September 2021 at 08:42:20 UTC, Alexey wrote:

>
> ```C
> #include <stdio.h>
>
> int main(int argc, char* argv[])
> {
>     unsigned char a = 0b100;
>     unsigned int b = ~a;
>     return 0;
> }
> ```
>

and here
```C
#include <stdio.h>

int main(int argc, char* argv[])
{
     unsigned char a = 0b100;
     unsigned char b = ~a;
     return 0;
}
```
will C also silently promote a to int and silently truncate it to 
uchar? - should those under-carpet things also happen in D just 
to save C's behavior?



More information about the Digitalmars-d mailing list