News for hackers. Stuff that matters.
Re:Zig 0.7.0 tagged by xandroo on Sunday November 08, 2020 @04:49PM (#25029402)
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.
Re:Zig 0.7.0 tagged by jedisct1 on Sunday November 08, 2020 @04:51PM (#25029421)
In ReleaseSafe mode, too.
Re:Zig 0.7.0 tagged by secondcoming on Sunday November 08, 2020 @04:53PM (#25029431)
Fine, 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?

Re:Zig 0.7.0 tagged by dnautics on Sunday November 08, 2020 @04:58PM (#25029475)
It'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
Re:Zig 0.7.0 tagged by jedisct1 on Sunday November 08, 2020 @04:56PM (#25029462)
Develop 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.

Re:Zig 0.7.0 tagged by xandroo on Sunday November 08, 2020 @04:58PM (#25029479)
Alternatively, 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

Re:Zig 0.7.0 tagged by secondcoming on Sunday November 08, 2020 @05:15PM (#25029615)
Only with signed ints, since unsigned overflow is defined behaviour.
Re:Zig 0.7.0 tagged by gameswithgo on Sunday November 08, 2020 @05:07PM (#25029552)
probably 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.