should int/short/byte implicitly cast to dchar/wchar/char?

KennyTM~ kennytm at gmail.com
Mon May 16 21:11:00 PDT 2011


On May 17, 11 12:04, Don wrote:
> Nick Sabalausky wrote:
>> "Steven Schveighoffer" <schveiguy at yahoo.com> wrote in message
>> news:op.vvk48tn9eav7ka at localhost.localdomain...
>> (int/short/byte can sometimes implicitly cast to dchar/wchar/char)
>>> What do you think?
>>>
>>
>> Ick! Kill it!
>>
>>
>
> It's not easy. Simply disallowing it would make code like this illegal:
>
> char c = '0' + n;
>
>

It is already illegal. You cannot implicitly convert an 'int' to 'char' 
(Error: cannot implicitly convert expression (48 + n) of type int to char).


More information about the Digitalmars-d mailing list