BDE 4.14.0 Production release
|
Provide a standard compliant version of errc
.
errc
enumeration typetypedef
for bsl::errc::Enum
or std::errc
Canonical header: bsl_system_error.h
This component defines an enumeration bsl::errc::Enum
, and marks it eligible to participate as an error condition in the system_error facility. In C++11 mode, the vendor-supplied <system_error>
implementation is used instead, and the corresponding names from std
are imported into bsl
.
This component also defines the type alias bsl::ErrcEnum
that can be used as the type of the errc
enumeration in both C++03 and C++11 mode. Because errc
is defined in C++11 as an enum class
, we cannot emulate use of std::errc
in C++03 mode - that tag can either be used to qualify the enumeration literals or name the type, but not both. This component chooses to have bsl::errc
be the literal qualifier and bsl::ErrcEnum
be the type so to use this component portably, one would, for example, write
In this section we show intended use of this component.
Suppose we would like to have more descriptive and non-macro names for errno
system error values. We can use the errc
from the system_error facility of the C++ standard for this.
First, we do something that will set an error value.
Finally, we check for that error using the descriptive name.