thrift icon indicating copy to clipboard operation
thrift copied to clipboard

THRIFT-5637: Add `no_constructors` option to C++ compiler

Open alkis opened this issue 1 year ago • 1 comments

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.

  • [x] Did you create an Apache Jira ticket? (Request account here, not required for trivial changes)
  • [x] If a ticket exists: Does your pull request title follow the pattern "THRIFT-NNNN: describe my issue"?
  • [x] Did you squash your changes to a single commit? (not required, but preferred)
  • [x] 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.

alkis avatar Sep 04 '24 12:09 alkis

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

alkis avatar Sep 09 '24 11:09 alkis

@Jens-G could you advise how to move this forward?

alkis avatar Feb 19 '25 11:02 alkis

@Jens-G could you advise how to move this forward?

The usual way would be that someone fom the C++ folks looks at it and decides how to continue.

Jens-G avatar Feb 19 '25 20:02 Jens-G

Awesome, thank you @Jens-G!

alkis avatar Feb 20 '25 08:02 alkis