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

deadalnix deadalnix at gmail.com
Thu May 19 22:12:44 UTC 2022


On Thursday, 19 May 2022 at 18:20:26 UTC, 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. The `*` imply a promotion of its argument. It is very easy to 
define bool has promoting to int without making bool an int.


More information about the Digitalmars-d mailing list