[rust-dev] Integer overflow, round -2147483648
danielmicay at gmail.com
Sun Jun 22 21:15:20 PDT 2014
On 22/06/14 06:43 PM, Clark Gaebel wrote:
> I think a reasonable middle ground is to have checked operators that
> look a little funny. Kind of like swift, but in reverse:
>> malloc((number_of_elements +~ 12) *~ size_of::<int>())
> Where adding a ~ to the end of an operator makes it check for overflow.
> This would certainly look nicer than stuff like:
> lying around in low level data structures code.
> It also keeps the default fast, which is very important.
> - Clark
Along with an opt-in lint to warn about usage of the unchecked
operators, I think that's the way to go. Since it would be backwards
compatible, it doesn't need to be done before 1.0.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 819 bytes
Desc: OpenPGP digital signature
More information about the Rust-dev