itom-project / itom

itom core repository
https://itom-project.github.io/
Other
13 stars 5 forks source link

Minimum supported C++ compiler standard #249

Closed photoniker closed 1 year ago

photoniker commented 1 year ago

Currently, itom is still designed to work with C++03, however there are many reasons, why it could be an advantage to move to a minimum requirement of C++11. I think that we should finally discuss this before we start implementing things from C++11 (e.g. nullptr, =delete operator, auto types…). Qt moved to C++11 from Qt 5.7 on.

In the past, I still wanted to supported C++03 since it was desired that even older compilers of older stable linux versions (I have Debian in mind) are able to compile itom. However, I guess that even most used Debian distributions are able to compile C++11 code, now.

From my point of view, we could fix now that a C++11 compiler is a minimum requirement to compile itom. What are your thoughts about this? Please comment on it. Of course Visual Studio 2010 would not be able to fully support C++11, however I guess that this is ok for us.

To be honest, I am currently not sure if we really are C++03 compatible right now, since probably nobody tried to compile itom with such an old compiler in the last month. Maybe this is a reason to move now to the official minimum requirement of C++11.

Please comment on this, such that we can fix this point.

[Issue created by M. Gronle: 2020-10-27] [Last updated on bitbucket: 2020-12-02]

[Comment created by M. Gronle: 2020-12-02] Implemented in commit 1c1c6ac

[Comment created by M. Gronle: 2020-11-10] After having discussed this issue with ITO, too, I would say that we should go for C++11 as minimum C++ standard.

[Comment created by M. Gronle: 2020-11-04] In order to get a better overview about supported C++ standards in different compilers and operating systems, I collected a list of different, common operating systems:

Windows:

C++11 is fully supported from MSVC2015 on (many features also in earlier versions, however all from 2015 on).
C++14 is fully supported from MSVC2017 15.0 on

Linux:

Here is a list of commonly used linux versions, which still have at least an active maintainance / LTS support:

C++11 is fully supported from gcc 4.8 on

C++14 is fully supported from gcc 5.0 on.

Result:

The gcc compiler, shipped with all currently maintained linux versions of Debian, Ubuntu, CentOS and Fedora can compile with the C++11 standard.

[Comment created by Johann Krauter: 2020-10-27] I am also for a defined standard, C++11.

[Comment created by M. Gronle: 2020-10-27] Yes, setting the C++ standard in cmake would be the goal.

I would vote for c++11, since I know many people who use Visual Studio 2015 in their companies (including me and many of my colleagues) and VS2015 does not (fully) support c++14, c++17 or c++20.
Recently we got a question here in the issue section from sobody who used Ubuntu 18.04, which is not so old. Based on this resource https://packages.ubuntu.com/de/bionic/gcc I think that this ubuntu only has gcc 7.0, which supports many C++17 features, but not all. All in all, I think that we should be compatible to Ubuntu, Debian, Fedora and CentOS, which are 5-6 years old.

And for Visual Studio I vote for VS2015 (for me a must-have) or younger and therefore for C++11.

[Comment created by Oliver Schwanke: 2020-10-27] Qt moved to C++11 from Qt 5.7 on:

Qt 5.9 has reached EOL in May 2020

C++11 is supported from gcc 4.8.1. on, which is from 2013, current stable is 10.2, however reasonable is to have one version before, so 9.3 should be available on most systems.

I am not sure whether anyone wants to actually support a 10 year old compiler and push new features to it unless you are paid to do so(or it is your main target, thanks peppermintOS :slight_smile: .

On my end, i do not have a system that old so i cannot even check whether everything in itom is compiling on that.

Agreeing on a c++ standard would be nice.

It is possible to set the standard in the cmake projects, so everyone can read it.

I’m in favor of cpp17, because cpp20 is too new … and some cpp17 features are quite good if used…

Ofc the toolchain needs to be verified.

[Comment created by M. Gronle: 2020-10-27] @{557058:94a4d902-09b9-4da2-b162-13a0e106634d} : Can you check if anybody or any lab system at ITO is currently using itom, that is still compiled with MSVC 2010 or older? What about the windows / linux systems or C.P. or T.H. (Mr. never-change-a-running-system :slight_smile: )?