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

Proposal: define exceptions when !JSON_USE_EXCEPTION #1444

Closed
wants to merge 3 commits into from

Conversation

vslashg
Copy link
Contributor

@vslashg vslashg commented Nov 16, 2022

The current behavior of only defining these classes when exceptions are enabled creates difficulties for large projects with trees of dependencies.

OSS libraries will often reasonably try/catch on these exceptions, which causes those libraries not to build when !JSON_USE_EXCEPTION. This is easy to miss in those libraries, which don't test for nonstandard configurations of their dependencies, but it makes those libraries difficult to use in projects with large dependency trees that have already configured jsoncpp in this way.

The current behavior of only defining these classes when exceptions are enabled creates difficulties for large projects with trees of dependencies.

OSS libraries will often reasonably try/catch on these exceptions, which causes those libraries not to build when !JSON_USE_EXCEPTION.  This is easy to miss in those libraries, which don't test for nonstandard configurations of their dependencies, but it makes those libraries difficult to use in projects with large dependency trees that have already configured jsoncpp in this way.
@BillyDonahue
Copy link
Contributor

BillyDonahue commented Nov 17, 2022

I think I understand the build problem but it sounds like a system that can't compile without these definitions is a system that's expecting JsonCpp to throw them. But if it was built without JSON_USE_EXCEPTION, it won't. So they're anticipating a different API from the one they're linking with. Would unconditionally providing these definitions (but never actually using them) really help?

I feel like a library in a different configuration like this should be treated like a separate library entirely. If there's a dependency diamond it needs to be resolved more thoroughly.

@baylesj
Copy link
Contributor

baylesj commented Sep 12, 2024

I think I understand the build problem but it sounds like a system that can't compile without these definitions is a system that's expecting JsonCpp to throw them. But if it was built without JSON_USE_EXCEPTION, it won't. So they're anticipating a different API from the one they're linking with. Would unconditionally providing these definitions (but never actually using them) really help?

I feel like a library in a different configuration like this should be treated like a separate library entirely. If there's a dependency diamond it needs to be resolved more thoroughly.

I agree. Let's close.

@baylesj baylesj closed this Sep 12, 2024
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

Successfully merging this pull request may close these issues.

3 participants