glassechidna / zxing-cpp

ZXing C++ Library
Apache License 2.0
610 stars 435 forks source link

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

Open etodanik opened 1 year ago

etodanik commented 1 year ago

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.

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