https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90370

--- Comment #5 from Florian Weimer <fw at gcc dot gnu.org> ---
(In reply to Florian Weimer from comment #4)
> (In reply to Jonathan Wakely from comment #3)
> > The issue is basically that the C++ Standard Library defines two categories
> > for error numbers known to the implementation: "generic" and "system", where
> > the former is for the POSIX errno values, and the latter is for other error
> > numbers used by the OS for other kinds of errors that aren't covered by a
> > POSIX errno macro (which might be other non-standard EBLAH macros that the
> > OS adds to the POSIX ones, or some totally different error numbers used by
> > the OS, e.g. Windows has its own error numbers unrelated to errno). The
> > question is which category zero belongs to.
> 
> This is really confusing for native POSIX systems because the generic/system
> terminology appears to be swapped for them.  This is also reflected in the
> standard:
> 
> <http://eel.is/c++draft/syserr.errcat.objects#4>
> 
> And in the documentation:
> 
> <https://en.cppreference.com/w/cpp/error/system_category>
> 
> With this observation in mind, I reach this conclusion:
> 
> For a native POSIX system, no translation of errno values is needed.  That
> suggests to me that all int values (the ev argument) correspond to a POSIX
> errno value, and therefore all error conditions crated by
> default_­error_­condition should be of the system_category category.

Sorry, I meant  generic_category on the last line (which really should be
called posix_category or perhaps errno_category, based on the required behavior
of default_error_condition).

Why do I consider generic/system terminology swapped?  A system error for
GNU/Linux is a POSIX error because the that's the kind of error numbers the
operating system uses.  If the application uses non-POSIX errors that are
unlikely (or impossible, in the case of Linux on most architectures) to occur
as operating system errors for different error conditions, I would call that a
“generic error” as in “not a system error”.

However, I do not think that there is an debate that an ERANGE error needs to
be of generic_category according to the specification, even though it is
clearly a system error from the GNU/Linux point of view.

If we say that all int error values are of generic_category, without further
translation, I think this mostly resolves this confusion.

Reply via email to