should int/short/byte implicitly cast to dchar/wchar/char?
Steven Schveighoffer
schveiguy at yahoo.com
Mon May 16 11:25:12 PDT 2011
On Mon, 16 May 2011 13:51:55 -0400, Steven Schveighoffer
<schveiguy at 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);
But this passes:
int i = -1;
dchar c = i;
So clearly there are some inconsistencies that need to be fixed, but the
situation is not as bad as I thought it was.
-Steve
More information about the Digitalmars-d
mailing list