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

Walter Bright newshound2 at digitalmars.com
Thu May 19 00:27:24 UTC 2022


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.


More information about the Digitalmars-d mailing list