On May 17, 11 02:25, Steven Schveighoffer wrote:
On Mon, 16 May 2011 13:51:55 -0400, Steven Schveighoffer
<schvei...@yahoo.com> wrote:

Currently, this works:

void foo(dchar i)
{
}

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

Damn, this originally started out as argc and argv, and I forgot how D
accepts arguments, so I switched it to this. Unsigned ints are
convertable to dchar, but signed ones are not (except for a couple
cases, which doesn't make sense).

For example, this fails:

dchar c = -1;
foo(-1);


This fails because the compiler can check in compile-time that 0xffff_ffff is > 0x10_ffff....

But this passes:

int i = -1;
dchar c = i;

....but this cannot. 'dchar' should be treated as lower-rank than 'int' and use value-range propagation on it.


So clearly there are some inconsistencies that need to be fixed, but the
situation is not as bad as I thought it was.

-Steve

Reply via email to