On Tue, Jan 14, 2014 at 15:08, Steffen Nurpmeso wrote:
> Description:
> The *c() family, which exists in FreeBSD and derivatives, is
> helpful whenever something has to be done in the error case
> (like necessary cleanup), while still being able to inform the
> user about the original error that caused the problem.
The motivation for this isn't clear.
if (failure()) {
saved_errno = errno;
cleanup();
errc(1, saved_errno, "fail");
}
vs
if (failure()) {
saved_errno = errno;
cleanup();
errno = saved_errno;
err(1, "fail");
}
That's it, right? ok, I see the point, so maybe I should have said the
motivation isn't compelling. It doesn't save that much work and leads
to API explosion.
If it could magically eliminate the need to save errno entirely,
that'd be aswesome, but just knowing you need to save errno is
literally 90% of the problem and this doesn't solve that.