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

[Accepted] SDL 0043 - Move to the new C++11 standard. #132

Closed
theresalech opened this issue Mar 29, 2017 · 13 comments
Closed

[Accepted] SDL 0043 - Move to the new C++11 standard. #132

theresalech opened this issue Mar 29, 2017 · 13 comments

Comments

@theresalech
Copy link
Contributor

theresalech commented Mar 29, 2017

Hello SDL community,

The review of "Move to the new C++11 standard." begins now and runs through April 4, 2017. The proposal is available here:

https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0043-upgrade-c++-standard.md

Reviews are an important part of the SDL evolution process. All reviews should be sent to the associated Github issue at:

#132

What goes into a review?

The goal of the review process is to improve the proposal under review through constructive criticism and, eventually, determine the direction of SDL. When writing your review, here are some questions you might want to answer in your review:

  • Is the problem being addressed significant enough to warrant a change to SDL?
  • Does this proposal fit well with the feel and direction of SDL?
  • If you have used competitors with a similar feature, how do you feel that this proposal compares to those?
  • How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
    Please state explicitly whether you believe that the proposal should be accepted into SDL.

More information about the SDL evolution process is available at

https://github.com/smartdevicelink/sdl_evolution/blob/master/process.md

Thank you,
Theresa Lech

Program Manager - Livio
theresa@livio.io

@joeljfischer
Copy link
Contributor

joeljfischer commented Mar 29, 2017

Is the problem being addressed significant enough to warrant a change to SDL?
I think this is an open question. Roughly how much time will such a change take? And furthermore, what is the risk of new bugs, especially since it seems like there are a number of deep changes that would be coming with this change?

It seems like portability might be an issue as noted in potential downsides, as well.

Does this proposal fit well with the feel and direction of SDL?

n/a

If you have used competitors with a similar feature, how do you feel that this proposal compares to those?

n/a

How much effort did you put into your review? A glance, a quick reading, or an in-depth study?

A quick reading

Please state explicitly whether you believe that the proposal should be accepted into SDL.

I don't have enough information to answer this question at this time.

@joeygrover
Copy link
Member

I believe each stakeholder will need to evaluate if their targets can support the move, but overall I support moving forward with a more modern version of C++. It would make the project better in terms of verbosity/complexity, stability and performance.

@Jack-Byrne
Copy link
Contributor

It sounds like a good idea to upgrade to a newer standard, but I agree with Joel that this introduces a huge risk for introducing a lot of new bugs due to the nature of these changes.

Is there unit test coverage that could validate the changes made by upgrading to the new standard? Or would there need to be unit tests added/modified to test the changes made by this proposal?

The proposal also states that these changes can be made with regression testing. How is that claim justified?

@joeljfischer
Copy link
Contributor

Is there any sort of guess on timeline or lines of code changed for this?

@AGaliuzov
Copy link
Contributor

@joeljfischer, @JackLivio
The main idea is to start using the c++11 in SDL. I think we don't need to change all the code at once.
The only thing that must be changed at the very beginning is custom smart pointers.
All the other code could be changed step-by-step during working with code in general.

For example:

  1. We will use the lambdas. So during working on some task the developer could change as well some code around his implementation and remove old functors in favour of lambdas.
  2. We will use auto variable - suppose one wants to change some function which contains some ugly, long for loops - good point to use either for_each loop or at least auto variable to initialize iterator

@mfoedisch
Copy link
Contributor

I think, we should try to stay rather compatible. Like that SDL would easier integrate into existing environments (e.g. GENIVI, AGL, QNX, ).

@theresalech
Copy link
Contributor Author

This proposal will remain in review until April 11, 2017. The author of the proposal will provide a list for C++11 features that are allowed, as well as a limitation list, in QNX 6.5. Steering Committee members will then determine the impact of these changes on their own implementations, as well as how to approach this breaking change (timing, providing notice, LTS, etc.).

@AGaliuzov
Copy link
Contributor

According to the QNX Release notes for QNX6.5 it uses gcc4.4 toolchain
The status of the supported feature could be found by the following link
https://gcc.gnu.org/gcc-4.4/cxx0x_status.html.

Our proposal is to use the following list of the features in OpenSDL:

  1. Move semantics and rvalue reference.
  2. Move constructors and assignment operators.
  3. Variadic templates
  4. Initializer list
  5. Static assertion
  6. Auto typed variables
  7. SFINAE
  8. Strongly typed enums
  9. Default and deleted function
  10. smart pointers - std::unique_ptr and std::shared_ptr

We propose:

  1. Remove own SharedPtr class in favor of std::shared_ptr - no risk to break existing code.
  2. Use std::unique_ptr instead of std::auto_ptr
  3. Use lambdas instead of functors - we don't need to change all the code right now. It could be done step by step by any developer.

@Jack-Byrne
Copy link
Contributor

Jack-Byrne commented Apr 11, 2017

  1. I agree it would be better to use std::shared_ptr instead of our own utility implementation.
  2. This is necessary since auto_ptr is deprecated.
  3. Not sure what the benefit is for replacing existing functors with lambdas.

@AGaliuzov
Copy link
Contributor

@JackLivio I didn't say that we have to replace existing functors - I mentioned that it is better to use lambdas instead. And it would be good to change if possible some ugly functors. For example, you can compare following snippets

struct ProtoV4AppsOnDevice : std::unary_function<ApplicationSharedPtr, bool> {
  connection_handler::DeviceHandle handle_;
  ProtoV4AppsOnDevice(const connection_handler::DeviceHandle handle)
      : handle_(handle) {}
  bool operator()(const ApplicationSharedPtr app) const {
    return app && handle_ == app->device() &&
                     ProtocolVersion::kV4 == app->protocol_version()
               : false;
  }
};

 std::copy_if(app_list.begin(),
               app_list.end(),
               std::back_inserter(v4_proto_apps),
               ProtoV4AppsOnDevice(handle));

Compare the above one with the following

 std::copy_if(app_list.begin(),
               app_list.end(),
               std::back_inserter(v4_proto_apps),
               [handle](ApplicationSharedPtr app) {
                return app
               ? handle_ == app->device() &&
                     ProtocolVersion::kV4 == app->protocol_version();
    });

So the lambda allows to simplify the logic in some cases.

@theresalech
Copy link
Contributor Author

Members of the Steering Committee need more time to review this proposal, so it has been deferred and will remain in review until April 18, 2017.

@theresalech theresalech changed the title [In Review] SDL 0043 - Move to the new C++11 standard. [Accepted] SDL 0043 - Move to the new C++11 standard. Apr 19, 2017
@theresalech
Copy link
Contributor Author

The Steering Committee has agreed to accept this proposal, and noted that we will need to identify implementation timing and clarify LTS before implementation.

@smartdevicelink smartdevicelink locked and limited conversation to collaborators Apr 19, 2017
@theresalech
Copy link
Contributor Author

Issue entered: [SDL 0043] Move to the new C++11 standard

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

No branches or pull requests

6 participants