Hacker News new | ask | show | jobs
by yaantc 3139 days ago
Great points, plus from the puff readme: "In Rust, integer overflow is checked at run time in debug mode and silently ignored in release mode by default, as the run time performance penalty was deemed too great.". With puff, it's statically checked. I haven't delved into puff's details, but to support as many environment as possible in an easy way today, a DSL generating C seems a pragmatic decision.
2 comments

Small note here, we left the spec broad enough that if the runtime checks get cheap enough, we can do them in release mode as well.
By default, but it is possible to enable integer overflow for release builds with "-C overflow-checks".
And that comes with a performance penalty. Maybe it won't, in a future version of Rust, but it does for now.
But it's about checking it compile time because of overhead not at runtime.