Should you be able to initialize a float with a char?
Steven Schveighoffer
schveiguy at gmail.com
Thu May 19 00:48:17 UTC 2022
On 5/18/22 8:27 PM, Walter Bright wrote:
> On 5/18/2022 3:31 PM, H. S. Teoh wrote:
>> If you were to ask me, I'd say prohibit implicit conversions between
>> char and non-char types. Otherwise you end up with nonsense code like
>> the above.
>>
>> But IIRC, the last time this conversation came up, Walter's view was
>> that they are all integral types and therefore should be
>> interconvertible. The topic at the time was bool vs int, but the same
>> principle holds in this case.
>
> People routinely manipulate chars as integer types, for example, in
> converting case. Making them not integer types means lots of casting
> will become necessary, and overall that's a step backwards.
Supporting addition on char types (even with char + int) is still
possible without allowing implicit conversions.
-Steve
More information about the Digitalmars-d
mailing list