6 ms·
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*/ } exa
by dahfizz 4y ago
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.
- RustyRussell 4y agoNot for bool though.