Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Being able to ignore return values is something that C had before they had function prototypes. The compiler didn't know if something returned a value, so it couldn't check. There's no good reason for that misfeature in a newer language.

Go apparently does it that way to make "defer" work.[1]

[1] https://github.com/golang/go/issues/20803



When was the last time you checked the return value of 'printf' ?

Would you consider it a good thing to be forced to do?

Moreover, there are functions for which "not ignoring" the return value isn't the same as "checking it" (e.g malloc, fopen, etc.).

(CppCon about error handling: https://www.youtube.com/watch?v=GC4cp4U2f2E )




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: