When I'm writing a user define function, should I return 0 if the function is successful or a non null value?
I personally like to return 0 if my function is successful, but I always see error handling more like (!var)
and less like (var != NULL)
. So would it be better to return some value like 1
, as known as TRUE
, even in a non-Boolean situation?
What does Stack Overflow suggest?
Reason why I'm asking is because I wrote a non-Boolean wrapper for WINAPI BOOL CreateProcessW
and it threw my code off because I was returning 0
in the wrapper and before I was checking if TRUE
.