Re:GCC's new fortification level: The gains and costs
by abainbridge on Monday September 19, 2022 @02:35AM
(#32895010)
From the Zig language reference:
Zig has many instances of undefined behavior. If undefined behavior is detected at compile-time, Zig emits a compile error and refuses to continue. Most undefined behavior that cannot be detected at compile-time can be detected at runtime. In these cases, Zig has safety checks. [...] When a safety check fails, Zig crashes with a stack trace
[ Parent
| on HN ]
Re:GCC's new fortification level: The gains and costs
by Gibbon1 on Tuesday September 20, 2022 @04:36PM
(#32917455)
> Zig crashes with a stack trace
I hope the people behind Zig understand that in critical applications that's totally unacceptable.
Re:GCC's new fortification level: The gains and costs
by kristoff_it on Tuesday September 20, 2022 @06:04PM
(#32918424)
What exactly is the language supposed to do then. Let's say that you caused an integer overflow, or tried to perform an out of bounds access in a dynamic array. What's the program supposed to do if not crash.
If your point is that some software shouldn't crash, then yes, for sure. But that's on you to not make programming errors in your code.
In fact Zig does help you create software that doesn't crash like not many other programming languages do, for example by not having language features that rely on implicit memory allocations. This gives you the opportunity to always have a fallback strategy if a memory allocation fails.