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

[rosidl_generator_cpp] Generate constructors that take all msg members as arguments #842

Open
jmachowinski opened this issue Nov 26, 2024 · 1 comment
Assignees

Comments

@jmachowinski
Copy link

Feature request

Feature description

It would be nice, if for every msg a constructor would be generated, that takes all msg members as arguments.
There would be some positive effects from this:

  • Compile time check if msg was modified
  • Makes it harder to 'forget' to initialize a member
  • Enforces RVO

Implementation considerations

Would slightly raise compile times
Default constructors must stay for compability

@alsora
Copy link

alsora commented Dec 8, 2024

FYI, see this old discussion on the topic: #749
The purpose was different though.

In that case, we wanted to avoid to pay the cost for a default initialization.
The solution we discussed in that case was based on the use of aggregate initialization with designated initializers, which requires C++ 20 (currently ROS uses C++ 17).

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

2 participants