[OT] The Usual Arithmetic Confusions
Paul Backus
snarwin at gmail.com
Fri Feb 4 14:01:43 UTC 2022
On Friday, 4 February 2022 at 04:28:37 UTC, Walter Bright wrote:
> On 2/3/2022 8:25 AM, Paul Backus wrote:
>> The inconsistency is the problem here. Having integer types
>> behave differently depending on their width makes the language
>> harder to learn,
>
> It's not really that hard - it's about two or three sentences.
Two or three sentences here, two or three sentences there--it's
not much on its own, I agree, but all these little things add up.
And the fact is, C and C++ programmers *do* find these rules
difficult to learn and remember in practice. That's why articles
like the one that started this discussion are written in the
first place.
> There's really no fix for that other than making the effort to
> understand 2s-complement.
[...]
> Trying to hide the reality of how computer integer arithmetic
> works, and how integral promotions work, is a prescription for
> endless frustration and inevitable failure.
2s-complement is "the reality of how computer integer arithmetic
works," but there is nothing fundamental or necessary about C's
integer promotion rules, and plenty of system-level languages get
by without them.
More information about the Digitalmars-d
mailing list