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

Steven Schveighoffer schveiguy at yahoo.com
Mon May 16 10:51:55 PDT 2011


Currently, this works:

void foo(dchar i)
{
}

void main(string[] args)
{
     foo(args.length);
}

Does this make any sense?  When is it useful to be able to call a  
dchar-accepting function with a random integer?

I would say dchar should be settable from an (unsigned) integer literal  
(for those cases where you want to use a specific bit pattern), but from  
any integer or unsigned integer?

Same goes for short to wchar and byte to char, and the unsigned  
equivalents.

What do you think?

There is a bug report related to this:

http://d.puremagic.com/issues/show_bug.cgi?id=5995

-Steve


More information about the Digitalmars-d mailing list