[RFC] Consider adding a function to convert error name to errno
Rocket Ma
marocketbd@gmail.com
Fri May 8 08:21:45 GMT 2026
Got it. Then what about return the errno back, instead of writing it
into a pointer? I have some rationales:
1. The old interfaces like strerror directly return string, instead of
writing error desc into a pointer, so directly returning the errno
preserves the "convention".
2. Error names are fixed, while sigal names are not fixed, for
example, SIGRTMIN+1.
3. Directly return the errno reduce some code complexity.
4. Errnos are all positive, so returning -1 could indicate error.
In this case, we have the function signature:
int strnameerror_np(const char *errname);
> * Rocket Ma:
>
> The prefix “str” makes the name reserved. We have function like strtod
> that produce non-string results.
>
> Thanks,
> Florian
>
More information about the Libc-alpha
mailing list