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

Code Migration for latest C++ Features. #3509

Open
saurabhjangir opened this issue Jun 14, 2019 · 5 comments
Open

Code Migration for latest C++ Features. #3509

saurabhjangir opened this issue Jun 14, 2019 · 5 comments
Labels

Comments

@saurabhjangir
Copy link
Contributor

As I am working on latest mongocxx-driver which needs c++ 11 feature to get compile successfully, I came across some auto_ptr related errors in mongodbBackend (Which is basically deprecated in C++ 11).
As a resolution we just need to study unique_ptr and replace it smartly with auto_ptr.
So just wondering if we're having any plans for the same ?

@fgalan
Copy link
Member

fgalan commented Jun 14, 2019

Not sure if we already have an issue about migrating to c++11 (maybe you could have a look to the open issues to check it) but anyway it seems to be a good idea and, as far as a know, a pre-requisite for the MongoDB drive migration.

Thus, I think it would be a good idea to do that but before starting to work in the MongoDB driver migration. However, some questions I have about it:

  • Appart from auto_ptr, is there any other "pattern" we should change in the current code base? How large would be the change?
  • Is c++11 supported by CentOS 7 (the official OS for Orion)? I guess so, but we maybe we should ensure before starting this task

Thanks!

@saurabhjangir
Copy link
Contributor Author

I didn't find any open Issue related to the migration.
Yes, As we know mongocxx driver needs c++11, so for compiling code with mongocxx latest driver we need to build the code with -std=c++11 flag, but while doing so I've found that mongodbBackend throws error because mongodbBackend uses auto_ptr at several places which is deprecated in C++ 11 . So for the current situation I have removed -Werror so that mongodbBackend don't throw any error while compiling it with C++ 11. As this is just a workaround, replacing auto_ptr with unique_ptr will be a better Idea.
Now coming to your questions,

  • Apart from mongodbBackend (where auto_ptr is used ), rest of the code is building successfully with C++ 11 standards. Although I am just talking about compiling the code, I can't say anything about the run time behavior as I've not tested it yet. Hopefully apart from auto_ptr rest of the code is fine. We'll confirm it after testing only.

  • Yes CentOS 7 support c++11.

Thanks :)

@fgalan
Copy link
Member

fgalan commented Jun 14, 2019

It seems to be good news :)

Thus, I'd suggest going ahead with a PR replacing auto_ptr with unique_ptr. Behavior at run time will be checked by travis when you cast the PR with a pretty good coverage based on tests, don't worry about it.

@saurabhjangir
Copy link
Contributor Author

That's great !! I'll share these changes ASAP.

@fgalan
Copy link
Member

fgalan commented Mar 15, 2021

Not sure if we already have an issue about migrating to c++11 (maybe you could have a look to the open issues to check it) but anyway it seems to be a good idea and, as far as a know, a pre-requisite for the MongoDB drive migration.

The pre-requisite disappeared at the end because we are using a C-based driver. However, it may be a good idea to move to C++11 in some moment, so this issue stills.

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

No branches or pull requests

2 participants