[asio] error_code and categories
With the new changes to asio error handling; I'm updating some code and running into a problem on windows with vc8 The old syntax: void my_handler(const asio::error& error) { if (!error) { // woot sucess } else { // failure } } The new syntax: void handler(const boost::system::error_code& error) { if (error == boost::asio::error::success) { // doesn't work because error_code::category() differs } else { // failure } } doesn't seem to work because the error_code categories differ. Am I doing somthing wrong/stupid? Cheers, Dean
Hi Dean, Dean Kassmann wrote:
With the new changes to asio error handling; I'm updating some code and running into a problem on windows with vc8 [...] if (error == boost::asio::error::success) { // doesn't work because error_code::category() differs } [...] doesn't seem to work because the error_code categories differ. Am I doing somthing wrong/stupid?
You should probably still use "if (!error) ...". Thanks for pointing this out -- it's something I had overlooked. I should remove the error::success constant since you're right and there is no single value for success any more. Cheers, Chris
participants (2)
-
Christopher Kohlhoff
-
Dean Kassmann