Re:Don’t assume that safety comes for free: a Swift case study
by acqq on Tuesday December 06, 2016 @07:59PM
(#13119685)
> I've also argued for degradation to bignums as the best default.
It has sense for Python and Perl code but not for the code produced by something that would be better C than the current C. If the performance is critical (as to have to effectively no slowdown compared to what the CPU can achieve), the CPU machine code instructions already do "the right thing" and it's the HL languages that abstract the carry or the saturation away to make the wrong plain "+".
C with the CPU-specific extensions can "do the right thing." It's the "standard" "language lawyers" that are once again wrong.
I've also argued for degradation to bignums as the best default. This way the result is always correct. Of course, that means a performance hit on all arithmetic code unless you opt out of that, and you could make the case that this is also an unacceptable default.
In any case, consider the "crashing is the best default choice" to be qualified with "if you're going to have some default choice for fixed-size integers."