Remix.run Logo
jeroenhd 13 hours ago

Very few programming languages default to checked increments. Most Rust or Java programmers would make the same mistake.

Writing a function to do a checked addition like in other languages isn't exactly difficult, either.

koito17 10 hours ago | parent | next [-]

> Most Rust or Java programmers would make the same mistake.

Detecting these mistakes in Rust is not too difficult. In debug builds, integer overflow triggers a panic[1]. Additionally, clippy (the official linter of Rust), has a rule[2] to detect this mistake.

[1] https://doc.rust-lang.org/book/ch03-02-data-types.html#integ...

[2] https://rust-lang.github.io/rust-clippy/master/index.html#ar...

paulddraper 12 hours ago | parent | prev | next [-]

Yes but those languages have defined overflow.

cozzyd 11 hours ago | parent [-]

-fwrapv

12 hours ago | parent | prev [-]
[deleted]