C++17 is a major step forward. It includes quite a few interesting new features: C++17 - Wikipedia
However, moving forward to C++17 would also mean saying goodbye to a few old compiler versions. I think we should then at least require GCC 7, LLVM Clang 5, Apple Clang 10 (Xcode 10.0), VS2017 version 15.7, or Intel C++ 19.1, and drop support for earlier versions. Would that be OK?
@Niels_Dekker et al thanks for looking into this, submitting a PR, and creating this thread!
I have been using C++17 with ITK for quite some time, and it does have very nice advantages.
There is not a ITK/toolchain usage scenario I am aware of where the toolchain cannot be upgraded to support C++17 when upgrading ITK.
When upgrading the required standard version, we should also make a note in the ITK Software Guide and describe the associated minimum compiler versions here:
Thanks Matt. I believe that the required compiler versions that I proposed with PR #3969 basically support all C++17 language features. For some of the C++17 stdlibrary features, even more recent compiler versions may be needed. For example, std::filesystem is added with GCC 8, whereas the PR only requires GCC 7. And clang still does not support the parallel C++17 algorithms from <algorithm>. For details, you may have a look at Compiler support for C++17 - cppreference.com of course!
Note also that the PR still supports VS2017 (at least from version 15.7), even though I wouldn’t mind dropping that one either
So I just want to say that PR #3969 is quite a modest proposal
As @Niels_Dekker mentioned, filesystem support and parallel algorithm support, while wonderful to have as @dzenanz pointed out, are not currently broadly available, and we should not require it. They could optionally be used when available, but I do not think we can require them at this point.
So with this proposal we are not going to be able to purely adopt CXX 17. What does this mean for how ITK will work with CMake to ensure the required features are there? Currently its easy to do something like: target_compile_features( SimpleITKIO PUBLIC cxx_std_14 ) Are we going back to explicitly listing the C++ compile features ITK requires?
With the currently proposed minimum required compiler version, all C++17 language features will become available. Only a few C++17 std library features may then not yet be used, within the implementation of ITK. (This is just a limitation to ITK developers. ITK users do not need to be bothered, as they may have a newer compiler version for their application.)
Specifically, GCC 7 has all the C++17 language features, but its C++17 std library is still incomplete and “experimental”. So personally I would like ITK to move forward to GCC 9. But I don’t know if there are still ITK users out there using GCC 7 or GCC 8, do you?
If there are still ITK users that are using GCC 7 or GCC 8, I’m OK with requiring GCC 7 for now.
These individual features are now less relevant and projects should generally prefer to use the high level meta features instead. Individual compile features are not provided for C++ 17 or later.
So it sounds like the suggestion to just do: target_compile_features( mylib PUBLIC cxx_std_17 ) even if the compiler has an incomplete std library for the standard.
Standard support of 18.04 ends on May 31, 2023. What is the target date for the next release? If it is after that date does it still need to be supported by ITK?
We are looking at June for ITK 5.4, but I done not think bumping required GCC beyond 7 is going to address the std completeness issue – e.g. filesystem support is still newer across toolchains and it is not available in wasm toolchains, possibly others.
The next release candidate is expected soon, so maybe after that? I primarily use Windows, so I don’t have a strong opinion about minimum GCC version, aside from “higher is better”
Another release candidate? I am not sure why actually releases are not occurring.
More specific to the point, I would expect the requirements for the next release (non-RC) to be set, and after the release the build requirements may change.