Characters in D

Jacob Carlborg doob at
Sat Nov 2 17:07:03 UTC 2019

On 2019-11-02 16:44, Eugene wrote:

> next code is ok according on what is written in book:
> char[] cyrillics = ['п', 'р', 'и', 'в', 'е', 'т']; //not compiled

This might be a bit confusing. But the type of a character literal 
changes depending on it's content:

static assert(is(typeof('a') == char));
static assert(is(typeof('п') == wchar));
static assert(is(typeof('😊') == dchar));

So the type you have on the right side does not match the type specified 
on the left side.

/Jacob Carlborg

More information about the Digitalmars-d mailing list