-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Exception-free mode? #438
Comments
I'm not sure what happens in the case of (1), might be a better question for stack overflow. I'm curious of the answer though. With respect to (2).. As it stands there is still one remaining internal component that still requires exceptions. I haven't prioritized converting that to be exception free as nobody has actually asked for a truly exception free mode yet. I don't think it would be a huge amount of work to get the last bit of that done and tested. If that is something that would be important for your project perhaps we should discuss your timeline and what would be involved in getting there? |
Hey thanks for the thoughtful response! I am quite open to contributing to this, so maybe you could provide a little overview of which pieces of code this applies to. The timeline for my project is mostly at the mercy of my engagement level with my contract work and other life events so in all likelihood, and being realistic about it, i wouldn't need need this for quite some months (estimate a year). I guess I don't need to sell you on the concept any further, mainly I'm just thinking that having the library work easily in an exception-free environment makes it more attractive from a portability standpoint. |
+1 for being able to compile and run the library without use of exceptions. |
+1 from me too. |
…Update bundled HTTP library to remove the use of exceptions for error handling. All exceptions have been replaced with the error_codes used by the rest of the library either returned or as an output parameter. Documentation has been updated to note when this has happened. The main library interface has been updated to ensure that all functions that can throw are labeled as such and have a non-throwing overload. Nothing has been removed from the main library interface so anyone who uses exception handling with the main library is unaffected. These changes are being done in preparation for adding options to build WebSocket++ on platforms with exceptions disabled. references #438 #908
|
@sourjon (and any others interested) The This support is about 98% full featured. There are no cases where you lose precise error handling ability by foregoing exceptions. I am tracking one minor situation where exceptions were used to suppress blanket errors thrown during a handler. If exceptions are disabled I think handlers will not throw, but users who disable exceptions at the library level without disabling them at the compiler level might have a strange edge case. I don't like the way that error suppression is being done anyways so I'll be looking for a way to refactor it for other reasons. There is a bit more work to do on automated testing (I want the test suite to exercise some of the exception free paths) as well as documentation. There is also a bit more work to do to document and/or better support using the Asio transport in exception free mode. Asio has an exception free mode as well, that you can activate by defining This requires the library user to define this global "asio threw something" hook and deal with the result sensibly. In my sampling of WebSocket++ example programs, there were 4-5 calls to this asio defined throw function. I intend (at some point) to look in more detail at these and confirm whether there isn't an alternative that the core library can switch to. I suspect that there is not. What this means for users of the WebSocket++ Asio transport in exception free mode is that they will need to define an |
@zaphoyd , great! Looking forward to checking it out! |
…Update bundled HTTP library to remove the use of exceptions for error handling. All exceptions have been replaced with the error_codes used by the rest of the library either returned or as an output parameter. Documentation has been updated to note when this has happened. The main library interface has been updated to ensure that all functions that can throw are labeled as such and have a non-throwing overload. Nothing has been removed from the main library interface so anyone who uses exception handling with the main library is unaffected. These changes are being done in preparation for adding options to build WebSocket++ on platforms with exceptions disabled. references zaphoyd#438 zaphoyd#908
I'm designing a tool that has a component that requires linking or incorporating into a "host" codebase to (portably) augment an application with a websocket server.
The requirement already involves the clang/LLVM compiler environment so it does narrow things down somewhat, but I am slightly worried about C++ exception support being required in order to compile a translation unit that includes websocketpp headers.
In particular I anticipate a hypothetical situation involving the need to link my static library containing a websocketpp server with a codebase that requires
-fno-exceptions
in its build configuration. Suppose that it magically breaks when that isn't the case...So there are two things that I am wondering about:
throw
s? This is only reasonable to ask for if none of the internal control flow and algorithms rely on C++ exceptions (which I hope is the case).As for (2), though, it might not be practical because I see some hints such as this from the changelog
indicating that exceptions are an important part of the logic.
The text was updated successfully, but these errors were encountered: