HackerTrans
TopNewTrendsCommentsPastAskShowJobs

abjKT26nO8

no profile record

comments

abjKT26nO8
·há 6 anos·discuss
C will not throw an exception when you try to dereference a null pointer. C does not have exceptions. Instead, dereferencing a null pointer results in undefined behaviour, which is often tough to deal with. Having an exception thrown is a lot nicer. In C the compiler is free to make optimizations, based on the programmer's vigilance about which pointers may or may not be null, which you would have never expected on your own[1]. Debugging these issues is hell.

[1]: <https://www.imperialviolet.org/2016/06/26/nonnull.html>
abjKT26nO8
·há 7 anos·discuss
Karen?
abjKT26nO8
·há 7 anos·discuss
Why would you not just use the ssh command?
abjKT26nO8
·há 7 anos·discuss
I've just checked and it appears that c++'s std::vector::resize may throw std::bad_alloc when malloc fails, but rust's Vec::resize's interface doesn't leave any room to report any errors, so I guess that it will panic...? That's sad.