Boost logo

Boost Users :

Subject: [Boost-users] exception, filesystem, system_error and consistency
From: Michael Schuerig (michael.lists_at_[hidden])
Date: 2011-06-10 16:09:00

I haven't used C++ for several years and it's only a few weeks since
I've looked at boost for the first time. Thus it's likely that my
understanding of things isn't quite up to scratch.

In my first C++ project for years, I'm already using boost::filesystem
and I'm using boost::system::system_error to wrap error codes returned
by Linux API functions. For the latter purpose, I intend to use
boost::exception for its ability to add diagnostic information to
exceptions. At the top-level of my own code, I implement plain C
interfaces and therefore need to convert all exceptions back to their
original error codes.

Poring over docs and headers, I noticed that neither
boost::system::system_error nor boost::filesystem::filesystem_error are
derived from boost::exception. Instead they implement an independent
exception hierarchy.

I found this disconcerting. For one thing, I have to catch and handle
the respective exceptions separately. Far more importantly, though, I
was expecting consistency among boost libraries and now see that this is
not the case apparently.

When there is more than one way to do something, this automatically
raises the question which one is the right way. Regarding boost, I'm
wondering whether all libraries are created equal or whether there is an
undocumented gradation from "stable, recommended" to "experimental,


Michael Schuerig

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at