Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
dahfizz
· 3y ago · 0 comments
The proposal fits my intuition. When the return value is an error code, truthy values are an error.
int rc = func(); if( rc ) { /*handle error*/ }
examples from the stdlib: connect(), stat(), etc. Hell, even main is defined to return 0 on success, nonzero on error.
Comments
[–]
RustyRussell
3y ago
Not for bool though.