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

THRIFT-5637: Add no_constructors option to C++ compiler #3037

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alkis
Copy link
Contributor

@alkis alkis commented Sep 4, 2024

This PR adds the option no_constructors in the C++ generator. This option elides declaring and defining:

  • constructor/destructor
  • move/copy constructor/assignment

In addition this PR fixes some minor issues:

  1. gen_no_skeleton_ documentation was incorrect
  2. when templates are requested, avoid any virtual functions

Allowing the compiler to emit the default set of constructor/destructor/assignment operators makes the code faster as it allows inlining when they are trivial. This improves creating deep/elaborate thrift objects.

  • Did you create an Apache Jira ticket? (Request account here, not required for trivial changes)
  • If a ticket exists: Does your pull request title follow the pattern "THRIFT-NNNN: describe my issue"?
  • Did you squash your changes to a single commit? (not required, but preferred)
  • Did you do your best to avoid breaking changes? If one was needed, did you label the Jira ticket with "Breaking-Change"?
  • If your change does not involve any code, include [skip ci] anywhere in the commit message to free up build resources.

@Jens-G Jens-G added the c++ label Sep 4, 2024
@alkis alkis changed the title Add no_constructors option to C++ compiler THRIFT-5637: Add no_constructors option to C++ compiler Sep 6, 2024
@alkis
Copy link
Contributor Author

alkis commented Sep 9, 2024

Perhaps the option should be aggregates instead of no_constructor and classes be made into structs instead?

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

Successfully merging this pull request may close these issues.

2 participants