What is the legal range of chars?

monarch_dodra monarchdodra at gmail.com
Sun Jul 28 01:05:40 PDT 2013


On Wednesday, 19 June 2013 at 20:09:54 UTC, Jonathan M Davis 
wrote:
> Good to hear.
>
> - Jonathan M Davis

Resurrecting this thread for a related question: What is the 
legal range a dchar can hold?

is it 0 .. 0x110000, or basically, just 0 .. 2^^32?

For example, writing this:
dchar d = 0x110000;
Will result in:
Error: cannot implicitly convert expression (1114112) of type int 
to dchar.

Yet:
uint v = uint.max;
dchar d = v; //Perfactly fine.

So the question is: While I know you *can* put anything you want 
in a dchar, is it actually legal? is the "dchar d = 0x110000;" 
thing just the whole "value range propagation" thing being weird? 
A bit more background on the thing would be nice.


More information about the Digitalmars-d-learn mailing list