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

Walter Bright newshound2 at digitalmars.com
Thu May 19 03:46:42 UTC 2022


On 5/18/2022 5:55 PM, max haughton wrote:
> People do indeed (I'd question whether it's routine in a good D program, I'd 
> flag it in code review) manipulate characters as integers, but I think there's 
> something to be said for forcing people to go char -> suitable integer -> char.

Casts are a common source of bugs, not correctness. This is because it is forced 
override of the type system. If the types change due to refactoring, the cast 
may no longer be correct, but the programmer will have no way of knowing.


More information about the Digitalmars-d mailing list