-
Notifications
You must be signed in to change notification settings - Fork 216
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
Moving to C++11 or C++14 #590
Comments
A w e s o m e!I actually was going to propose it at some point soon and offer help in the code migration. I'd like to help. Please, let me know if/where I can help. GCC 4.8IMHO, when moving to C++11, there is little point to support anything older than GCC 4.9. The GCC 4.8 is dead, see boostorg/gil#282 (comment) |
I was conservative in my proposal to maximize the effect with the least possible change but we can do a bigger jump. Type-traits wouldn't be a problem since we're nearly there in the initial proposal (need Clang 3.0). Regarding MP11, I didn't pay much attention, is MP11 much superior than MPL? I can't find the list of compilers or language features MP11 depends on. I see variadic templates and template aliases in the overview so I guess these features are required. If this is correct it means we'd need at least GCC 4.7(4.9), Clang 3.0, VS 2013 and Intel 12.1 which is not that high requirement.
Well, we have to agree about a set of features and compilers and then you are free to go with proposing anything you like :) |
There is a short list in the readme at GitHub, so:
I wonder what do they need Clang 3.3 for and what about other compilers. |
Often, when you get rid of TypeTraits, you need to get rid of MPL or do some plumbing.
Without a doubt. It's simpler, cleaner, faster, easier on compiler.
GCC 4.9 or later (GCC 4.7, 4.8 support is limited). Talk to @pdimov
Sure. Currently, I'm just seeing your proposal as opportunity to make some suggestions here myself, but I since I'm not involved in the core development, I'll follow your lead regarding the requirements. |
Right, I appreciate your suggestions. I don't have a strong opinion about the minimum versions. I would have nothing against going directly to C++14. C++17 is probably not an option though I'd like to use @barendgehrels What do you think about it? |
Thanks @awulkiew for opening this discussion! I neither have a strong opinion on minimum versions (thanks for the tables above!). It is actually a user issue, maybe @barendgehrels knows more about user needs/costraints. Also does it make sense to apply the new standard first to new features or move the whole library directly to C++11 (or later) or even support two versions? |
Thanks for this. Yes, I think at some point we should move to C++11 or so. Of course I don't know all users, and I agree that we should ask the list first to see which versions of the language they are using. I know some users which are using C++11 internally - so for them this would be very welcome, but OTOH if we would go to C++14 directly, that would be a big problem: they cannot upgrade Boost anymore. This will be the case for many users. How are other Boost libraries doing this? Just drop support for C++03, or create a clone, freeze the current version ("geometry") and continue with, for example, Boost.Geometry2 ? Like we discussed in Brussels I think. Anyway, let's first ask the Geometry list to see if they like the idea, and then the Boost list to see how other libraries are handling this (or maybe you know this already). |
There have been numerous discussions about migrating Boost to newer versions of C++. AFAIK, there is no grand plan in place. Each library is independent here and maintainers are free to switch their libraries to newer versions, especially libraries which are not core dependencies of other Boost libraries. One quote from @pdimov that I remembered, https://lists.boost.org/Archives/boost/2018/11/244180.php
|
I think it's more about specific compilers than a standard because various compilers implement certain sets of features. Standard is theoretical definition of features, compiler version is practical (+compiler bugs). E.g. if they are using GCC 4.9 or later in their company they could use some of the C++14 features already assuming it's not against their guidelines to compile with
The question is: would significant number of users want to use C++03 Geometry and at the same time other libraries further developed in future versions of Boost? In that case we could consider maintaining both versions of Geometry at the same time and by maintaining I understand making sure it compiles with future versions of other libraries, so no bug fixes or new features. Otherwise we could simply bump the requirements and force users who want to use older Geometry to use older versions of other libraries as well. If really needed these users would be forced to marry new Boost with old Geometry and resolve problems by themselves.
I'd rather freeze the current version as Geometry03, GeometryOld or something like that and simply move forward with Geometry (like SpiritClassic and Spirit). |
To me, Spirit Classic is different as it's a maintained line of 1.8.x to some extent. Isn't it enough to freeze implicitly via Boost release?
I'd argue that it's important to label library with minimal required C++ standard version rather than relying on selection of C++ features. |
If really necessary but I'd prefer to avoid that.
I have nothing against it. :)
I agree. The features mentioned here are only for us to decide what we'd like to do. In addition to explicitly stating that we require C++11 (but only as general requirement) I'd suggest explicitly labeling library by specific versions of compilers. This way from user perspective everything would be even more clear since they wouldn't have to know which version supports all features from the standard and at the same time we would be able to pick earlier version than the one supporting all features if we didn't need all of them. Just like MP11 depending on GCC 4.7. Yes I know the support is partial but maybe we don't need all of it. Furthermore if we agreed to your suggestion about GCC 4.9 we would still have to state this compiler version is required because technically all C++11 features were implemented in GCC 4.8.1. So there is no running from compiler versions supporting features in ways satisfying our needs. Compiler version is more practical than C++11 standard. |
I know, and I know we can decide for our own - but what happened in practice for other libraries?
Of course compilers are important, but they follow a standard and users usually follow a standard. The standard is specified in makefiles / when compiling. Organizations where I've worked for are often flexibel in compilers (some use clang, some use gcc - for some OS you use other compilers, with the same codebase) but are not flexibel in standard. And indeed sometimes only a specific subset of C++11 features are allowed to be used, to still support some older versions of compilers.
I'm talking about large organizations, with 100s of developers on one codebase. They prepare these upgrades for months. You cannot specify a new standard overnight without breaking several things at the same time. The same, indeed, holds for compilers versions.
Good idea, I would prefer that indeed over Geometry2 - besides that, freezing a library would be an option for me personally - but I don't know if that holds for all our users. The drawback of renaming the current version is that current users have to adapt their includes, so it still requires some effort for them.
Complete maintenance will require too much effort. But just porting some obvious bugs on request might be an option. Therefore I would prefer to upgrade after all rescaling has been removed. That takes me quite some time already, sorry for that, but the end is visible now. |
Approaches are different. For example
There are libraries that require C++11 or C++14 since their beginning.
Yes. What I'm trying to explain is that even you pin at GCC 4.8 based on the list of C++ features it supports, you may be forced to remove 4.8 from the list because some features will simply not work due to bugs. Those bugs in the GCC 4.8 and other old compilers/versions will not be fixed. |
@mloskot thank you! |
I lean against @mloskot's proposal about supporting a minimal required C++ standard version. Then we can also comment on how this is implemented in various compilers, to help users. |
I hope this is not out of scope for this conversion, but I would be interested in the position with regard to a matter related to language versions other than the minimum required version. Is there a policy in Boost.Geometry with regard to contributions that require newer language features but do not break the build for compilation with older language versions? For example, in this file
Would, similarly Pull Requests be acceptable that optionally make functions constexpr that would only be allowed to be constexpr since C++14 or that provide C++20 concepts for better compiler error messages but conditional on some similar macros like !BOOST_NO_CXX14_CONSTEXPR or !BOOST_NO_CXX20_CONCEPTS (last name made up)? Edit: I can see that an issue with that might be that bugs in such conditional segments could slip through the tests done by CI if different language settings are not tested automatically. |
@tinko92 replying to your insight from Gitter on October 2, 2019 3:54 PM:
Generally speaking, I think your approach is valid and worth considering. If Boost.Geometry will allow similar approach is yet to be discussed, I think. |
@tinko92 Conditionally enabled features from future standards are of course welcome. There are some places where this is already done in the library, e.g. models, index and transformations. We just have to make sure that the usefulness of a feature is greater than the cost of maintaining more complex code. Prefer solutions that are close to the native language. E.g. consider C++14 Furthermore if you think that some macro could be used in other libraries too you could consider proposing an inclusion to Boost.Config. |
@awulkiew Your #686 (comment) made me wonder if one of baby steps could be adding |
@mloskot Yes, that's a good idea. In general modernizing math. But I think the first thing we should do is to decide how we will handle this change. We should announce it for sure but first decide which version will be the first one requiring the newer standard and which standard exactly we're targeting C++11 or 14. The former is probably more realistic. ;) |
@mloskot I think I misunderstood you earlier. Adding |
@awulkiew Yes, my comment assumed no change to required C++ version yet, then
Yes, me too, I sign the switch to newer C++ with all my paws :)
Yes, I also think C++11 is the feasible step forward.
I have just asked the Boost mailing list about basic recommendations [geometry] Planning switch to C++11 and as answer received pointer to this excellent article on Phasing out C++03 Support in Boost by Peter Dimov. I think the "Suggested Policy" is a reasonable approach.
/cc @barendgehrels @vissarion @awulkiew ☝️ |
So I repeat here my comment of last year: "Therefore I would prefer to upgrade after all rescaling has been removed." We just have to wait a bit more. |
And we probably can go to C++14 then. |
@barendgehrels Then perhaps it's the right time to add the deprecation message to e.g. in
as per Peter's Suggested Policy. |
@mloskot : this message sounds in general fine to me and does not restrict us to a specific version. The only thing I doubt is the wording |
The Standard meaning of "deprecated" is exactly that, still there in the code, but will be removed at some later point. http://eel.is/c++draft/depr#2 |
@barendgehrels out of curiosity, why do you prefer to wait with it until the rescaling is removed? After announcing the change in the requirement of the C++ standard we wouldn't rewrite the library. In particular we could agree that we do not touch parts that you're working on. I think that for you nothing would change besides the fact that you would be able to use newer C++ while working on rescaling. Am I missing something? |
@awulkiew you are right, I first thought we would freeze a version, but that is not necessary and then waiting is not necessary. Thanks. |
Following discussion in boostorg#590, we are identifying support for C++03 as a candidate for removal from future releases of Boost.Geometry.
Following discussion in boostorg#590, we are identifying support for C++03 as a candidate for removal from future releases of Boost.Geometry. Issue deprecation warning during compilation in C++03 conformance mode Users can define BOOST_GEOMETRY_DISABLE_DEPRECATED_03_WARNING to disable it.
Following #590 (comment) I have submitted proposal with the deprecation announcement in #689. It needs to be refined after at least these two are agreed upon:
|
|
+1 |
Following discussion in boostorg#590, we are identifying support for C++03 as a candidate for removal from future releases of Boost.Geometry. Issue deprecation warning during compilation in C++03 conformance mode Users can define BOOST_GEOMETRY_DISABLE_DEPRECATED_03_WARNING to disable it.
@barendgehrels @vissarion I adjusted the deprecation message in #689 The only reason I'm a bit rushing this deprecation notice is that we are getting close to Boost 1.73 closure. |
@mloskot Yes, I agree, thank you. Btw, this is not a major change so I think we have time till Apr 8 or maybe even after beta is released. |
Following discussion in #590, we are identifying support for C++03 as a candidate for removal from future releases of Boost.Geometry. Issue deprecation warning during compilation in C++03 conformance mode Users can define BOOST_GEOMETRY_DISABLE_DEPRECATED_03_WARNING to disable it.
Would it be possible to add a 'Boost::geometry' CMake target, with |
@StefanBruens Please, make a feature request by opening a separate issue and I will try to implement it. There is Boost-wide preliminary CMake support (e.g. |
I'm happy to see Boost libs dropping support for ancient versions of C++, but shouldn't the C++14 requirement be listed at https://www.boost.org/users/history/version_1_75_0.html ? |
@jwakely Thank you for pointing it out. I've submitted the post-factum update in boostorg/website#590 and @glenfe kindly offered help in re-generating the HTML page on the website. |
Excellent, thanks! |
c++ < 14 was deprecated in boost 1.73, removed in 1.75: boostorg/geometry#590
I'd like to start a discussion about moving to the newer standard. Among other things it would definitely make some of the internals clearer than they are now. What do you think about it?
One solution would be to simply announce that Geometry drops the support for older compilers. We should also decide which C++11 features exactly we'd like to use because the support for different features was added in various versions of different compilers. I prepared a list of the most important features I think we could use and the list of 4 compilers below. I'll update it if someone suggests that additional feature is useful.
The feature I think would be the most useful is
auto
because it'd allow us to get rid of many very long template instantiations,typedef
s, etc. So I marked the features and minimum versions of compilers based onauto
feature below (so versions GCC 4.4, Clang 2.9, VS 2010, Intel C++ 11.0 and below). The youngest of these compilers is GCC 4.4 released in March 13, 2012. Of course we can relax it if needed, .e.g Rvalue references would also be useful and they are supported in the same versions besides Intel C++ which needs the next minor version. The next thing is I think lambda expressions but this would require GCC 4.5 and Clang 3.1 which basically means compilers released in and after 2012.See: cppreference, GCC, Clang, MSVC, Intel.
For context release dates of the compilers.
The text was updated successfully, but these errors were encountered: