Skip to content
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

Should we add an option to compile with no exceptions? #101

Open
etodanik opened this issue Sep 2, 2023 · 0 comments
Open

Should we add an option to compile with no exceptions? #101

etodanik opened this issue Sep 2, 2023 · 0 comments

Comments

@etodanik
Copy link

etodanik commented Sep 2, 2023

I'm building this as part of an Unreal Engine plugin. On some platforms it targets, exceptions aren't available, making it impossible to compile.

My suggestion is to add the necessary Cmake configs to be able to disable exceptions, as well as utilize #ifdef __EXCEPTIONS to replace exceptions with other types of error handling (asserts for stuff that's only likely to come out during development, and perhaps returns for some runtime stuff?).

I know it'd make the code a tiny bit uglier, but it'll make it a lot more portable too, since exceptions aren't always available.

Important Clarification:
There are essentially two options here.

  • Remove exceptions everywhere: This will allow people to compile this library both as a statically linked library to code that can't have exceptions on, and in environments where exceptions aren't available.
  • Remove exceptions that cross the shared library boundaries only: This would be perhaps simpler and a more minimal change (since the only exceptions in *.h are in ZXAlgorithms.h and any other exception that wants to cross the boundary of the shared lib can be either handled with a wrapper function or handled by a compile-time flag like I suggested). This approach would be far more limiting though, but would work for when use as a shared library is desired.

P.S
I'm willing to submit a PR should this be approved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant