Notices where this attachment appears
-
Embed this notice
@theorytoe Before becoming a zigger I thought that everyone who said that c code was error‐prone was just a rust tranny, but now that I've used zig I realize that in c it is very easy to just ignore errors accidentally and you might move on with an error‐prone function. In zig, however, you can either handle the error, return the error for the calling function to handle it, or just ignore the error, but if you choose to ignore it you have to be explicit (you have to do catch unreachable). I'm not saying that c code has to be buggy, but if you're using c you really have to be aware of what can fail and when you can just ignore the return value. And even if you make sure to return the error where appropriate, you still have to choose whether to print it there or in the calling function… Meanwhile in zig you get an error trace, so you can identify the source of the error without printing anything.