-
-
Notifications
You must be signed in to change notification settings - Fork 56.4k
Removed all pre-C++11 code, workarounds, and branches #23736
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
Conversation
|
@seanm, I welcome those changes and believe something like this should be done. But maybe we should target 5.x first and do it slightly more aggressive, including C++ 14 and/or C++ 17 features. Also, one of the things where some of our hacks should be removed in favor of a standard C++ feature is singletons. We have quite a few of them and could possibly replace them with std::call_once + std::once_flag. @opencv-alalek, what do you think? |
Why? 4.x already has
That's a whole other discussion. I'm not looking to drop C++11, I'm looking to drop C++03 and older. Increasing the minimum language dialect requires wider discussion I'd imagine, but I'm not at all involved in this project's governance... |
|
the major reason is that until 5.0 is released, we backport some patches to 3.4, which does not require C++ 11. For 5.0 we already decided to make C++ 14 the minimum required standard. Maybe we will raise it up to C++ 17, we will see. |
|
Well, I disagree, but it's up to you. I assume github allows you to merge this into either branch? |
|
Do I have to rebase my commits onto the 5.x branch? Or can everything be done from github? |
|
This patch breaks windows builds and documentation build: |
I think I've just fixed the doc build... |
f69dcc4 to
c27f024
Compare
|
There are still issues with Windows build (Visual Studio 2019 Developer Command Prompt v16.11.21) Perhaps we need some special handling for MSVC - https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/ , but if we choose this way, we can still break user's aplications with our |
Interesting. I've updated my commit with something like the vulkan header. I don't have Windows though, so this may take me a few trys with the help of github CI... |
c27f024 to
5cfe4de
Compare
5cfe4de to
de976c3
Compare
de976c3 to
4ab4fd0
Compare
|
Good, |
Seems most are due to missing headers, due to me removing the include in cvdef.h. I'll fix them. But some are from |
4ab4fd0 to
301c9b8
Compare
|
Actually, by including |
301c9b8 to
5dc01fd
Compare
5dc01fd to
bf4b6ca
Compare
bf4b6ca to
eb91f6b
Compare
...utorials/core/how_to_use_OpenCV_parallel_for_new/how_to_use_OpenCV_parallel_for_new.markdown
Show resolved
Hide resolved
| Here, the range represents the total number of operations to be executed, so the total number of pixels in the image. | ||
| To set the number of threads, you can use: @ref cv::setNumThreads. You can also specify the number of splitting using the | ||
| nstripes parameter in @ref cv::parallel_for_. For instance, if your processor has 4 threads, setting `cv::setNumThreads(2)` | ||
| or setting `nstripes=2` should be the same as by default it will use all the processor threads available but will split the | ||
| workload only on two threads. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please restore setNumThreads related description.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
This allowed removing a lot of dead code. Updated some documentation consequently.
eb91f6b to
0d71e26
Compare
|
Documentation warnings on Buildbot: |
Yeah, that's because I brought back the comments you asked me to. :) CI was green before. |
|
|
||
| @note Although values of a pixel in a particular stripe may depend on pixel values outside the stripe, these are only read only operations and hence will not cause undefined behaviour. | ||
|
|
||
| C++11 standard allows a parallel implementation with a lambda expression: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following documentation describes operator() overloading and other steps of the old version. I propose not to remove pre-C++11 code, but just remove ifdefs for C++11.
| sz = kernel.rows / 2; | ||
| } | ||
|
|
||
| //! [overload-full] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is reference to overload-full block in markdown.
| //! [convolution-parallel-function] | ||
| } | ||
|
|
||
| //! [conv-parallel-row-split] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same.
| int sz = kernel.rows / 2; | ||
| copyMakeBorder(src, src, sz, sz, sz, sz, BORDER_REPLICATE); | ||
|
|
||
| //! [convolution-parallel-function] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same,
| sz = kernel.rows / 2; | ||
| } | ||
|
|
||
| //! [overload-row-split] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same. See CI warnings.
|
@seanm friendly reminder. |
I don't understand what it is you want to do in those documentation files. And I'm not familiar with the file's syntax nor the meaning of those tags. Nor am I familiar with the classes the document is describing. I think I give up at this point. Feel free to take what I've started and continue it. |
doc/tutorials/core/how_to_use_OpenCV_parallel_for_/how_to_use_OpenCV_parallel_for_.markdown
Show resolved
Hide resolved
doc/tutorials/core/how_to_use_OpenCV_parallel_for_/how_to_use_OpenCV_parallel_for_.markdown
Outdated
Show resolved
Hide resolved
|
@asmorkalov ,
See #20361 |
|
I thought you didn't want this merged until 5.x? |
|
3.4 branch is considered EOL now (https://github.com/opencv/opencv/wiki/Branches), so we don't need to do backporting anymore (it was the main concern originally). And forward porting to 5.x will be done by the OpenCV team on a regular basis. I believe there is still no decision on minimal C++ standard for 5.x. |
Removed all pre-C++11 code, workarounds, and branches opencv#23736 This removes a bunch of pre-C++11 workrarounds that are no longer necessary as C++11 is now required. It is a nice clean up and simplification. * No longer unconditionally #include <array> in cvdef.h, include explicitly where needed * Removed deprecated CV_NODISCARD, already unused in the codebase * Removed some pre-C++11 workarounds, and simplified some backwards compat defines * Removed CV_CXX_STD_ARRAY * Removed CV_CXX_MOVE_SEMANTICS and CV_CXX_MOVE * Removed all tests of CV_CXX11, now assume it's always true. This allowed removing a lot of dead code. * Updated some documentation consequently. * Removed all tests of CV_CXX11, now assume it's always true * Fixed links. --------- Co-authored-by: Maksim Shabunin <[email protected]> Co-authored-by: Alexander Smorkalov <[email protected]>
This removes a bunch of pre-C++11 workrarounds that are no longer necessary as C++11 is now required.
It is a nice clean up and simplification.