Should you be able to initialize a float with a char?
Steven Schveighoffer
schveiguy at gmail.com
Thu May 19 20:01:14 UTC 2022
On 5/19/22 2:20 PM, Walter Bright wrote:
> On 5/19/2022 7:33 AM, Steven Schveighoffer wrote:
>> 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.
>
>
> Does that mean you prefer:
>
> a = 3 + cast(int)(b < c) * 5;
>
> ? If so, I don't see what is gained by that.
No, I find that nearly unreadable. I prefer the original:
a = b < c ? 8 : 3;
And let the compiler come up with whatever funky stuff it wants to in
order to make it fast.
-Steve
More information about the Digitalmars-d
mailing list