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

kdevel kdevel at vogtner.de
Thu May 19 19:13:04 UTC 2022


On Thursday, 19 May 2022 at 18:35:42 UTC, Walter Bright wrote:
> On 5/19/2022 1:05 AM, bauss wrote:
>> 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.
>
> It does not assume it, it tests for if it would be valid.

"However, the assumption that setting bit 5 of the representation 
will convert uppercase letters to lowercase is not valid for 
EBCDIC." [1]

[1] Does C and C++ guarantee the ASCII of [a-f] and [A-F] 
characters?
     https://ogeek.cn/qa/?qa=669486/


More information about the Digitalmars-d mailing list