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

deadalnix deadalnix at gmail.com
Thu May 19 22:11:18 UTC 2022


On Thursday, 19 May 2022 at 16:42:58 UTC, matheus wrote:
> On Thursday, 19 May 2022 at 04:35:45 UTC, Walter Bright wrote:
>> On 5/18/2022 5:47 PM, Steven Schveighoffer wrote:
>>> But I have little hope for it, as Walter treats a boolean as 
>>> an integer.
>>
>> They *are* integers.
>> 
>
> I always thought them as integers, yesterday I was adding some 
> new features do addam_d_ruppes' IRC client and I did:
>
>    auto pgdir = (ev.key == Keyboard.Key.PageDown)-(ev.key == 
> KeyboardEvent.Key.PageUp);
>
> So to get: -1, 0 or 1, and do the next action according the 
> input given from the user.
>
> Matheus.

This doesn't imply they are integer, but that they are 
convertible to integers.

You could do the same operation with the key being a short, and 
pgdir would be an int. It doesn't mean that shorts are int.


More information about the Digitalmars-d mailing list