[rust-dev] Integer overflow, round -2147483648

Vadim Chugunov vadimcn at gmail.com
Sun Jun 22 17:34:05 PDT 2014


On Sun, Jun 22, 2014 at 2:31 PM, Daniel Micay <danielmicay at gmail.com> wrote:

> On 22/06/14 05:09 PM, Rick Richardson wrote:
> > Apologies if this has been suggested, but would it be possible to have a
> > compiler switch that can add runtime checks and abort on
> > overflow/underflow/carry for debugging purposes, but the default
> > behavior is no check?  IMO this would be the best of both worlds,
> > because I would assume that one would really only care about checked
> > math during testing and dev.
>
> You would need to build an entirely separate set of standard libraries
> with checked overflow. Adding new dialects of the language via compiler
> switches is never the right answer. It seems that every time an issue
> like this comes up, people propose making a compiler switch as the option.
>

> If we had compiler switches for abort vs. unwinding, no tracing gc
> support vs. tracing gc support, no integer overflow checks vs. integer
> overflow checks and more, we would have a truly ridiculous number of
> language dialects. I think even 2 dialects is too much...
>

I am very skeptical about the idea having a single set of standard
libraries that are good for everyone.  If Rust ever gains any degree of
mainstream adoption, I predict that there *will* be switches to disable
bounds checks, stack overflow checks, etc, because different applications
have different needs.

Modern C++ compilers often have a bunch of runtime checks (stack overflow
protectors, iterator invalidation detectors, and so on) that may be enabled
or disabled, and nobody bats an eye at that.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20140622/6373c1a5/attachment.html>


More information about the Rust-dev mailing list