Implicit enum conversions are a stupid PITA

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Mar 25 06:51:44 PDT 2010


On 03/25/2010 06:58 AM, bearophile wrote:
> Walter Bright:
>> Disabling implicit integral conversions would make it unbearable to use.<
>
> Implicit conversion from signed to unsigned is too much unsafe (if you don't have integer overflows).
> C# can teach us two lessons on this. C# has disabled some implicit conversions and keeps other of them.

The problem is it asks you to insert casts all too often. I think the 
value range propagation is a principled and correct solution to that 
problem.

Andrei




More information about the Digitalmars-d mailing list