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

Raise C++ standard to C++20 #4380

Merged
merged 3 commits into from
Apr 9, 2023
Merged

Raise C++ standard to C++20 #4380

merged 3 commits into from
Apr 9, 2023

Conversation

ranisalt
Copy link
Member

@ranisalt ranisalt commented Apr 6, 2023

Pull Request Prelude

Changes Proposed

Raise the required C++ standard from C++17 to C++20. It has the following benefits (not exhaustive):

  • Potentially improved compile times using concepts instead of SFINAE for code where we use std::enable_if
  • More expressive code through the use of ranges (not range-for), views and spans
  • Native std::format that can replace fmt
  • constexpr if and consteval to perform more work during compile time
  • Coroutines, which can help writing generator functions where we currently generate a whole container of items before processing it (e.g. recursively navigating a container)

See more language features and compiler support.

Minimum compiler version with decent C++20 support is gcc 8 and clang 6, with gcc 9 and clang 8 being mostly feature-complete.

@Erza
Copy link
Contributor

Erza commented Apr 7, 2023

Native std::format that can replace fmt

I wish. Last time I checked a few months ago, GCC still didn't support std::format. I switched to C++20 on a project because I wanted to use it, and then found out that GCC still did not support the C++20 text formatting at the end of 2022....

GCC 13 finally supports it now, but it's not even released yet.

EPuncker

This comment was marked as resolved.

@ranisalt
Copy link
Member Author

ranisalt commented Apr 7, 2023

GCC 13 finally supports it now, but it's not even released yet.

It's just wishful thinking. We will still use libfmt, since we use colors, but maybe one day std::format matures enough :P hopefully the rest of the reasons are appealing enough

@ArturKnopik
Copy link
Contributor

ArturKnopik commented Apr 8, 2023

Please update <LanguageStandard>stdcpp17</LanguageStandard> to <LanguageStandard>stdcpp20</LanguageStandard> in theforgottenserver.vcxproj file

a lot of problems with lambdas, maybe the introduction of the C++20 standard will fix memory leaks by the way (#4288)

@ranisalt ranisalt changed the title Raise CXX standard to C++20 Raise C++ standard to C++20 Apr 8, 2023
@EPuncker EPuncker merged commit 5d62a1d into master Apr 9, 2023
@EPuncker EPuncker deleted the cxx20 branch April 9, 2023 11:02
EPuncker pushed a commit to EPuncker/forgottenserver that referenced this pull request May 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants