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

Consider upgrading to C++17 #8200

Open
fsimonis opened this issue Jun 7, 2020 · 4 comments
Open

Consider upgrading to C++17 #8200

fsimonis opened this issue Jun 7, 2020 · 4 comments

Comments

@fsimonis
Copy link
Contributor

@fsimonis fsimonis commented Jun 7, 2020

Context

OpenTTD currently requires C++17 for the visual studio compiler and C++11 for other compilers.
It may be a good idea to upgrade the required standard to C++17 altogether.

Upsides

  • Uniform requirement to prevent developers on Windows to accidentally commit code that requires C++11 or 14.
  • Keeping up with the standard is always a good idea
  • Opens-up more options to simplify and clean-up the code with
    • additional tools for locking
    • generic lambdas for saner STL usage
    • if/for initializer to reduce variable scopes
    • nested namespaces in case of future adoption

Downsides

  • Lifts the compiler baseline for most relevant features:
    • GCC 7
    • Clang 4 (5 for class argument deduction)
  • Drops support for

edit: clarify relationship of ubuntu and debian packages

@embeddedt
Copy link

@embeddedt embeddedt commented Jun 7, 2020

Drops support for Ubuntu 16.04 LTS, which reaches end of standarad support in April 2021.

You can actually get a newer GCC version on Ubuntu 16.04 from this official PPA. It's quite stable; I used it till I upgraded to 18.04 and never had any issues.

@fsimonis
Copy link
Contributor Author

@fsimonis fsimonis commented Jun 8, 2020

You can actually get a newer GCC version on Ubuntu 16.04

The OpenTTD Debian package would than depend on a package from a ppa. The package is imported from the Debian repository, thus depending on a Ubuntu ppa is not possible.

Simply dropping future updates would probably be the most straight-forward solution, but this has to be decided by the maintainers.

@techgeeknz
Copy link
Contributor

@techgeeknz techgeeknz commented Jul 3, 2020

We could always hold off until Debian finally gets around to upgrading to C++20 (sometime around 2030) 😁

FWIY, I am running Debian 9.12 as a templateVM in QubesOS R4.0; and that uses GCC 6.3.0.
I also have available GCC 7.3.1 in the default Fedora 26 templateVM, assuming I can figure out how to install the build dependencies; but I much prefer Debian.

The practical upshot of this, I guess, is that if you want stuff tested against various different compilers on different versions of Debian or Fedora; I can probably do that. QubesOS makes it ridiculously simple to create and spin up a new VM for whatever purpose (even including "disposable" VMs, which are automatically destroyed as soon as they are closed), so it would be no trouble at all to compile the source against multiple different configurations; each in its own unique, clean environment.

@fsimonis
Copy link
Contributor Author

@fsimonis fsimonis commented Jul 8, 2020

The purpose of this issue is to lift the minimum C++ version to further modernize the baseline.

Testing with the newest compilers is independent of this. I don't have an insight on the testing side of things.

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

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.