From: Beman Dawes (bdawes_at_[hidden])
Date: 2005-06-09 09:23:54
Peter Dimov suggested that Boost.Filesystem's error reporting codes use the
POSIX <cerrno>/<errno.h> codes as the portable way to encode errors.
That made a lot of sense for POSIX systems, and since POSIX is now an ISO
standard (ISO/IEC 9945:2002), other portions of Boost.Filesystem are also
as of the i18n branch being formally defined by reference to the ISO POSIX
Checking how the various standards interrelate as far as errno.h, cerrno,
and errno definitions are concerned, the C++ and POSIX standards both defer
to the C standard, although POSIX does add additional codes. No problems
As far as actual header implementations go, there was a concern that the
Windows errno.h implementations didn't provide the needed definitions
(since C only mandates EDOM, EILSEQ, and ERANGE). That turned out to be a
non-problem. The Windows implementations only provide a subset of the POSIX
macros, but with few exceptions they do provide all the macros
Boost.Filesystem users will need.
One exception was that Borland fails to define one of the needed macros.
There were also two cases where additional non-POSIX macros were needed,
but the standards do permit extensions, so again no problem. That has been
worked around by providing a <boost/filesystem/cerrno.hpp> header which
sucks in <cerrno> and adds any needed definitions.
I had some concerns about Boost.Filesystem headers gratuitously including
<cerrno> (or <boost/filesystem/cerrno.hpp>) because that could cause macro
name clashes. But it turned out the Boost.Filesystem headers have no reason
to include <cerrno> or <boost/filesystem/cerrno.hpp>. So no problem.
The CVS filesystem i18n branch now has the POSIX aligned error mechanisms
in place. Seems to work well and be a very nice improvement to the library.
Thanks to Peter for the suggestion!
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk