error_code using c++11 and boost
Hello, A project that uses Boost 1.6X (filesystem, uuid, asio) and C++14 on multiplatform. Does it make sense to use std::error_code in this project ? The concern is compatibility between boost and std. The filesystem_error exception will return a boost ::system::error_code which is not compatible with std::error_code as far as I can tell. Exception is not an option. Would it be possible for boost to implement some sort of convertion method from boost::system::error_code to std::errror_code? Thanks kind regards, Lars
On Fri, Nov 16, 2018 at 7:12 AM Lars via Boost-users < boost-users@lists.boost.org> wrote:
A project that uses Boost 1.6X (filesystem, uuid, asio) and C++14 on multiplatform.
Does it make sense to use std::error_code in this project ? The concern is compatibility between boost and std. The filesystem_error exception will return a boost ::system::error_code which is not compatible with std::error_code as far as I can tell. Exception is not an option.
Would it be possible for boost to implement some sort of convertion method from boost::system::error_code to std::errror_code?
You could use LEAF to avoid having to translate between std::error_code and boost::error_code in the first place. See https://zajo.github.io/leaf/#technique_disparate_error_types.
Ideally, the C++11 or C++14, just re-implemented the thing in boost for many years. Either pure C++14, or boost, so easy to choose. According the experience from our real product, still stick to boost is the best. So, to the real program, once you decided to use C++11 or C++14, you should consider always stick to it, and never mix the critical pat with boost's implementation. Back to the error code, it's best to stick one type of exception, since even the bridge would be also maintained by time. Today's C++ standard is never solid and published carefully, its quality degenerated a lot compared to the past, so it's the best to use something real reliable and able to finish the product, spend the least time and resource to handle the useless detail, even could be resolved at the very beginning. On Sat, Nov 17, 2018 at 12:12 AM Lars via Boost-users < boost-users@lists.boost.org> wrote:
Hello,
A project that uses Boost 1.6X (filesystem, uuid, asio) and C++14 on multiplatform.
Does it make sense to use std::error_code in this project ? The concern is compatibility between boost and std. The filesystem_error exception will return a boost ::system::error_code which is not compatible with std::error_code as far as I can tell. Exception is not an option.
Would it be possible for boost to implement some sort of convertion method from boost::system::error_code to std::errror_code?
Thanks
kind regards, Lars
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (3)
-
Bo Zhou
-
Emil Dotchevski
-
Lars