Should you be able to initialize a float with a char?

bauss jj_1337 at live.dk
Thu May 19 08:05:41 UTC 2022


On Thursday, 19 May 2022 at 04:10:04 UTC, Walter Bright wrote:
>
> There's nothing wrong with:
>
>     if ('A' <= c && c <= 'Z')
>         c = c | 0x20;
>

There is, this assumes that the character is ascii and not 
unicode.

What about say 'Å' -> 'å'?

It won't work for that.

So your code is wrong in D because D isn't an ascii langauge, but 
a unicode language.

As specified by the spec:

char	'\xFF'	unsigned 8 bit (UTF-8 code unit)
wchar	'\uFFFF'	unsigned 16 bit (UTF-16 code unit)
dchar	'\U0000FFFF'	unsigned 32 bit (UTF-32 code unit)


More information about the Digitalmars-d mailing list