News for hackers. Stuff that matters.
Re:Ask HN: Why do you use Rust, when D is available? by westicecoast32 on Friday June 12, 2020 @10:50AM (#23499774)
Really? I find that rust is worse than C++ thanks to clang

For example, is there a way in rust to get a runtime error when there's an int overflow?

Re:Ask HN: Why do you use Rust, when D is available? by zRedShift on Friday June 12, 2020 @11:05AM (#23499967)
Of course. rustc has the "-C overflow-checks" flag. Cargo turns it on by default for debug builds. To turn it on for release builds, just put "overflow-checks = true" in the [profile.release] section of your Cargo.toml.

Or better yet, the Rust standard library exposes all the relevant LLVM intrinsics for the primitives, so you have the {Integer}::checked_, {Integer}::saturating_, {Integer}::wrapping_, {Integer}::overflowing_ (inlined) functions to do all your integer math in an error-free fashion.

Re:Ask HN: Why do you use Rust, when D is available? by zucker42 on Friday June 12, 2020 @11:00AM (#23499902)
Yes there is. Overflow panics by default in debug mode, and you can turn that in in release mode with the overflow-checks compiler option. There's also checked_add.