[OT] The Usual Arithmetic Confusions
Dukc
ajieskola at gmail.com
Wed Feb 2 22:14:21 UTC 2022
On Friday, 28 January 2022 at 02:15:51 UTC, Paul Backus wrote:
> It's been argued in the past, on these forums, that these
> conversions are "just something you have to learn" if you want
> to do system-level programming. But if C++ programmers are
> still getting this stuff wrong, after all these years, perhaps
> the programmers aren't the problem. Is it possible that these
> implicit conversions are just too inherently error-prone for
> programmers to reliably use correctly?
As many downsides as warnings have in general, perhaps this is
where we should go for them. Those conversions are probably too
common to outright deprecate them. Still, old code would keep
compiling but the langauge would still clearly endorse explicit
conversions for new code.
We probably should not even warn on integer promotion. Code that
would explicitly cast on every place where that is done would be
incredibly ugly. But we could warn on unsigned/signed
conversions. Implicitly conversions to larger integers with same
signedness are not an antipattern imo, those can remain.
More information about the Digitalmars-d
mailing list