-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why are error codes being deprecated? #302
Comments
I wonder if this is linked to issue 143? |
It isn't all error codes being deprecated but rather, some functions are now exclusively indicating errors using exceptions. This makes sense. Remember that functions which have You also see this with |
What happens to code that compiles with -fno-exceptions?
… On 3 May 2018, at 19:29, Vinnie Falco ***@***.***> wrote:
It isn't all error codes being deprecated but rather, some functions are now exclusively indicating errors using exceptions. This makes sense. Remember that functions which have error_code& in their signature can still throw exceptions, the most common one being std::bad_alloc. What I think this change signifies is that io_context::run will not return errors which do not indicate exceptional circumstances.
You also see this with basic_io_object::cancel. In my opinion, this is a good change.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#302 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AAfK738pj_--VaWg-L2XuYLHc2iAev7Hks5tuz5dgaJpZM4TuVaw>.
|
That's up to you. You should define |
This seems to contradict the comment below:
// Only define the throw_exception function when exceptions are enabled.
// Otherwise, it is up to the application to provide a definition of this
// function.
… On 3 May 2018, at 19:35, Vinnie Falco ***@***.***> wrote:
What happens to code that compiles with -fno-exceptions?
That's up to you. You should define ASIO_NO_EXCEPTIONS=1 and then provide your own implementation of throw_exception that does whatever you want:
https://github.com/chriskohlhoff/asio/blob/master/asio/include/asio/detail/throw_exception.hpp#L33 <https://github.com/chriskohlhoff/asio/blob/master/asio/include/asio/detail/throw_exception.hpp#L33>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#302 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AAfK70q8p1uAhZy8hEEyN3XZfrTH1jUBks5tuz_pgaJpZM4TuVaw>.
|
I think you're reading it wrong. "Only define the throw_exception function" applies to the asio implementation not yours. In other words, if exceptions are enabled ( If you use |
Got it, thanks!
… On 3 May 2018, at 19:38, Vinnie Falco ***@***.***> wrote:
This seems to contradict the comment below:
I think you're reading it wrong. "Only define the throw_exception function" applies to the asio implementation not yours. In other words, if exceptions are enabled (ASIO_NO_EXCEPTIONS is not defined) then Asio will define the function throw_exception. Otherwise, you will have to define it.
If you use -fno-exceptions then you also need to define ASIO_NO_EXCEPTIONS=1.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#302 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AAfK71ut2GY9SvSQAAVwGclTHJw2-KaFks5tu0CUgaJpZM4TuVaw>.
|
If we change
to
it could be more clear. |
Can you provide any examples of a custom definition of |
Alternatively you could log to a file, launch another process, etc... many choices. Just not |
Has this issue been resolved? |
Done! |
I've noticed this in the file io_context.ipp:
Why is the use of
std::error_code
being deprecated?The text was updated successfully, but these errors were encountered: