Re:Sshole
by creata on Thursday November 05, 2026 @02:35PM
(#50383391)
I don't think so. In both Rust and C, the solution is the same - make the function explicitly fallible, instead of trying to preserve backward compatibility. In C, the function would probably just look like this, returning zero on success and negative on failure:
You can call such a signature "insane" if you want, and that's fine, but it would have averted the bug that is the topic of discussion.
[ Parent
| on HN ]
Re:Sshole
by markasoftware on Thursday November 05, 2026 @03:41PM
(#50384209)
what you are suggesting is a form of type safety. There are still degrees of type safety even in C, and this bug resulted from deciding that backwards compatibility is more important than type safety, which I think we agree on.
And C has effectively deprecated bad APIs over the years. Just not this one.
It's a perfectly sane signature, especially coupled with an API surface that uses the return channel for errors generally.