Problem with integral promotions

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Tue Jul 25 06:43:08 PDT 2017


On 7/24/17 6:46 PM, Walter Bright wrote:
> On 7/24/2017 2:07 PM, Walter Bright wrote:
>> Yes, I think a switch to enable the correct behavior, and a warning 
>> when the cases are encountered and the switch isn't thrown, is likely 
>> the best approach.
> 
> https://github.com/dlang/dmd/pull/7013

Yes, that should be workable.

I'm looking at some of the code that you have to update, and I'm 
wondering if ~ should still operate the way it does. While - on an 
unsigned is somewhat clear that you want a negative (and therefore a 
different type), ~ on an unsigned actually makes sense for the same type.

However, if C operates this way, this would be a huge trap for people 
who are porting code.

-Steve


More information about the Digitalmars-d mailing list