logoalt Hacker News

my-huge-pony • today at 5:18 PM • 1 reply • view on HN

In C the return value would be NULL, except it was changed by musl at some point.

Edit: at the beginning, crypt always returned a value. So hypothetical Rust return type would be a String, and then it would be retained for backward compatibility. Or something else would happen, this is a complex logic bug triggered by a 25 year old chain of events.


Replies

realharo • today at 5:28 PM

The type of the value in C is `char*`.

That's what led some people to write code where it crashes without checks. Which is still their mistake. But if the type was something that can't be implicitly used like an always-present value, that would have prevented the situation, even with those same people.

➕ show 1 reply