On 13-04-23 04:53 PM, Robert O'Callahan wrote: > On Wed, Apr 24, 2013 at 11:25 AM, Robert O'Callahan > <[email protected] <mailto:[email protected]>> wrote: > > I don't think bignums are useful in a browser because as a browser > developer I will choose data types that cover the ranges of values I > want to handle. If I think I need to handle integer values that > don't fit in 32 bits, I'll use a 64-bit integer type, or a floating > point type. Overflow always means I have a bug*. > > > Well, in C and C++ it does, and of course that's what most browser > developers are going to be used to. > > If we could rely on checked overflows in Rust, then we could start to > lean on that and declare that some tests that trigger overflow are > simply tests where task failure is an acceptable result. (Offensive as > this may to the cult of correctness, in practice priorities dictate we > have to do this kind of thing all the time --- declare that a bug is not > worth fixing as long as it's not exploitable.)
Sure. I'd be happy to look into this as a mode for rust; I don't think we can expect to make it "always on", but we could possibly make it "reasonably easy to turn on" on a crate-by-crate basis. First thing to do is look into enabling it. There are a variety of pieces lying around we could look into: http://llvm.org/docs/LangRef.html#range-metadata http://llvm.org/docs/LangRef.html#arithmetic-with-overflow-intrinsics http://clang.llvm.org/docs/UsersManual.html#controlling-code-generation http://embed.cs.utah.edu/ioc/ I suspect there's enough to work with there. It might require duplicating some of the lowerings that clang does in rust's trans layer. -Graydon _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
