Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

And yet somehow languages such as Rust, which have no UB (in the safe subset) manages to be within 5% of C and often faster in both real-world codebases and microbenchmarks.


It’s just a change in jargon for ‘marketing’ reasons.

For example: Rust will silently wrap signed integers in release mode even when it’s considered a bug and crashes in debug mode.


That is pretty much the only example where there's a compromise between performance and correctness as a difference between release and debug mode, and note that it's a) not undefined behaviour and b) does not violate any of rust's safety guarantees.

Every other example you mention is done by rust in release mode and the performance impact is minimal, so I would say it's a good counterexample to your claims that defining these things would hamstring performance (signed integer overflow especially is an obvious no-brainer for defining. Note that doesn't necessarily mean overflow checks! Even just defining the result precisely would remove a lot of footguns).


Signed overflow is not UB in rust. That's not the same thing at all.


It’s not.

You have missed my point.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: