On Thu, 2 Apr 2020 at 07:11, Vladimir Sementsov-Ogievskiy <vsement...@virtuozzo.com> wrote: > Somehow, in general, especially with long function names and long parameter > lists I prefer > > ret = func(..); > if (ret < 0) { > return ret; > }
Personally I prefer the other approach -- this one has an extra line in the source and needs an extra local variable. > Are you sure that adding a lot of boolean functions is a good idea? I somehow > feel better with more usual int functions with -errno on failure. > > Bool is a good return value for functions which are boolean by nature: > checks, is something correspond to some criteria. But for reporting an error > I'd prefer -errno. When would we want to return an errno? I thought the whole point of the Error* was that that was where information about the error was returned. If all your callsites are just going to do "if (ret < 0) { ... } then having the functions pick an errno value to return is just extra work. thanks -- PMM