Should you be able to initialize a float with a char?
Steven Schveighoffer
schveiguy at gmail.com
Thu May 19 14:33:14 UTC 2022
On 5/19/22 12:35 AM, 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.
>
> The APL language relies on bools being integers so conditional
> operations can be carried out without branching :-)
>
> I.e.
> a = (b < c) ? 8 : 3;
>
> becomes:
>
> a = 3 + (b < c) * 5; // I know this is not APL syntax
>
> That works in D, too!
I hope we are not depending on the type system to the degree where a
bool must be an integer in order to have this kind of optimization.
-Steve
More information about the Digitalmars-d
mailing list