3 ms·
it is one of the build modes: https://ziglang.org/documentation/master/#Build-Mode https://ziglang.org/documentation/master/#Build-Mode
by conradev 4y ago
it is one of the build modes: https://ziglang.org/documentation/master/#Build-Mode https://ziglang.org/documentation/master/#Build-Mode
- titzer 4y agoInteresting, thanks for the link. I think that disabling safety checks is a thing you should only do if you are studying the cost of safety checks (i.e. a compiler switch only available to compiler engineers). IMHO, the whole point of safety checks is to find the bugs that are in your program[1]. Crashing it safely with an exact source stack trace is the nice way of both motivating you to fix it and also helping you fix it. [1] And there are bugs in your program. Right now. Bugs. In. Your. Program. Running without safety checks is like closing your eyes and rolling the dice.
- quic5 4y agoThere's also the compromise of only disabling safety checks per block e.g. in your hot loop with `@setRuntimeSafety`[1] where you are confident that they aren't needed. [1] https://ziglang.org/documentation/0.10.1/#setRuntimeSafety https://ziglang.org/documentation/0.10.1/#setRuntimeSafety
- laserbeam 4y agoMost software should probably release with safety checks on. Certain software shouldn't (i.e. games). Toolchains like zig give you that option and respect that you can decide what's most appropriate for whatever you ship. Arguing that safety checks should always be enabled doesn't really make sense. Context matters.