should int/short/byte implicitly cast to dchar/wchar/char?
Jonathan M Davis
jmdavisProg at gmx.com
Mon May 16 21:09:51 PDT 2011
On 2011-05-16 21: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;
Well, forcing the n to be cast to char or byte would do it, but that _is_ kind
of ugly.
char c = '0' + cast(char)n;
Definitely a good point though.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list