Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Because there are more fail cases than success cases.
Usually, there is only one reason we succeed (because we’re successful :)), but there are a whole lot of reasons why we could fail. So
0means success, and everything else means failure, and the value could be used to report the reason.For functions in your code, this is different, because you are the one specifying the interface, and thus can just use a
boolif it suffices. Formain, there is one fixed interface for returns, and there may be programs that just report succeed/fail, but others that need more fine error reporting. To satisfy them all, we will have multiple error cases.