Benefit of defining success/failure function instead of using
success/!success
I was reading man page of gearman code
(http://manpages.ubuntu.com/manpages/precise/man3/gearman_success.3.html).
They are having two functions
bool gearman_success(gearman_return_t rc)
bool gearman_failed(gearman_return_t rc)
And code of those functions look like (libgearman-1.0/return.h):
static inline bool gearman_failed(enum gearman_return_t rc)
{
return rc != GEARMAN_SUCCESS;
}
static inline bool gearman_success(enum gearman_return_t rc)
{
return rc == GEARMAN_SUCCESS;
}
Both function does nearly same thing. One return true and another false.
What is the benefit of this code ?
Why not just have !gearman_success
Is there benefit of coding pattern or something , which I am missing here.
No comments:
Post a Comment