On 23/03/2017 20:26, Christopher Pisz via Boost-users wrote:
The following comparison fails for an error whom outputs "asio.misc" for errorCode.category().name() and "end of file" for errorCode.message()
The C++ 11 standard implies that each error category instance shall have a globally unique address and comparisons of equality shall use that address to compare. Unfortunately, this is not reliable in portable code, only the Dinkumware STL implements true address uniqueness anywhere in the process and it adds a full memory barrier to achieve that i.e. it's expensive. Boost's quality of implementation is the same as libstdc++ or libc++, you can get multiple instantiations in certain circumstances and those can have differing addresses. In my own code, I do the comparison operator first, and if that fails I do a strcmp() of the category's name(). To date, this has not bitten me. I would personally consider this aspect of error categories to be a defect in the standard, as specified it forces non-header-only implementation if you want it to be conforming, and even that doesn't cover RTLD_LOCAL which means you need to fall back onto named shared memory or some hack. Niall -- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/