-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
[Improvement] Add option to remove exceptions #296
Comments
Instead of an exception, should the library just call |
Just let it crash, crash hard crash early. You could throw in asserts for more protection. This will force the user to start using the library correctly. I do not see the average person disabling exceptions so its more of a special case. |
This should be done together with #244, because then we have to touch all exceptions anyway. |
Is there a more elegant way than to use preprocessor macros for this? (see https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_exceptions.html) |
The way that link details seems reasonable to me. At least the macro should only need to be used once with the try catch. Using -fno-exception may work with the standard library, but it will still fail to compile on any try catches or throws in your own code. I have never done anything like that personally, I think most libraries either support them or dont. I have seen projects where you can define a preprocessor to remove exceptions though. This may cause to much extra code to be worth it. Here is another library with the same discussion: gabime/spdlog#136. You could see how they implemented it. |
Thanks for working on this issue! I'm interested in this change to because I'd like to use your library in a project that builds with -fno-exceptions. |
Consider |
I implemented this change. Unfortunately, the test suite cannot be compiled with
(one test fails, because an exception from |
I shall merge this issue tomorrow. |
Merged 1ab26ab. The library now respects |
It would be nice to have the option to compile without exceptions for use on platforms where exceptions cannot be enabled., such as consoles etc.
Mainly for the reasons listed here: http://programmers.stackexchange.com/questions/113479/are-there-any-real-world-cases-for-c-without-exceptions
The text was updated successfully, but these errors were encountered: