5 ms·
It’s checked in debug modes (overflow is a runtime error). You can explicitly use the overflow operator (+%) if you know that’s the behavior you want.
by xandroo 6y ago
It’s checked in debug modes (overflow is a runtime error). You can explicitly use the overflow operator (+%) if you know that’s the behavior you want.
- jedisct1 6y agoIn ReleaseSafe mode, too.
- secondcoming 6y agoFine, but the bugs this will cause when people port code across from C or C++... probably painful. So, to be safe people should build both Debug and Release?
- jedisct1 6y agoDevelop in debug mode, deploy in safe release mode, and when you're absolutely sure that everything is safe, you can switch to the fast release mode. It is also possible to selectively disable/enable safety for individual code blocks.
- dnautics 6y agoIt's going to be a real strategy to write your code in releasesafe, identify hot code, and mark it off as releasefast on a function by function basis
- xandroo 6y agoAlternatively, there may be unfound overflow bugs in that C/C++ code. Worth noting that UB is also checked in ReleaseSafe mode. Related issue: https://github.com/ziglang/zig/issues/2301 https://github.com/ziglang/zig/issues/2301
- secondcoming 6y agoOnly with signed ints, since unsigned overflow is defined behaviour.
- gameswithgo 6y agoprobably deploy in saferelease mode always unless you are making something like a single player video game, or that otherwise has incredible performance needs but does not deal with untrusted data.