> Ted Unangst <[email protected]> wrote:
> |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.
>
> Ok, but under the surface errno is more than just assignment to
> simple storage. It may not be that terrible with TLS, or on
> platforms where accessing thread_self() is simply looking at
> a register and TSD errno is treated special, but personally the
> latter makes me sick :).
It makes you sick? I'm sorry, but that stuff is carefully designed
to even work in signal handlers, while the stuff you are talking about
is not.
> I think it is worth adding this interface, given how frequently
> this family is used:
>
> $ git grep -E '(err|warn)\(' origin/master|wc -l
> 19583
>
> all in all, including perl(1) stuff. A family that is used so
> often can well tolerate a few more options, i think.
> Just my one cent.
The origian ones are used lot. That is very seperate from your
argument that we need even more variants, which are not used now?
It's horse shit. You just failed to justify it entirely.
If your recommendation came with evidence, such as a full-tree audit
suggesting all the places it should be used, then you might have some
force. Otherwise, you are just trying to make a name for yourself,
and I'll let people figure out which one you created just now.