Nano-node: C++ 17 support

Created on 10 Aug 2018  路  10Comments  路  Source: nanocurrency/nano-node

C++17 is well supported by all major compilers and I think we should move soon-ish as it has a lot of useful features and improvements (std::optional/any/variant, nested namespaces syntax, filesystem, structured bindings, etc)

This issue tracks what needs to be done.

  • [x] Replace std::random_shuffle. This was deprecated in C++14 and removed in C++17. I'm making a PR that moves to random_pool#Shuffle *
  • [x] Upgrade cryptopp which uses std:: features that's been deprecated since C++11 and removed in C++17. cryptopp has been C++17 compliant since January **
  • [聽] Compile and run testes on clang, gcc and msvc 2015+ *
  • [ ] Verify that C++17 is supported by commonly used LTS versions

*) https://github.com/nanocurrency/raiblocks/pull/1045
) https://github.com/nanocurrency/raiblocks/pull/1068 / https://github.com/weidai11/cryptopp/pull/559
*
) node and wallet works on macOS/clang

Most helpful comment

@cryptocode It seems MSVC17 now has full support of C++17

All 10 comments

What Linux distro versions have gcc/clang versions that support c++17 installed or supported?

I鈥檇 like to make sure we don鈥檛 require too new of a distro version, especially if it gets us off of commonly used LTS versions.

Added that point to the list of things to do. No rush moving to C++17, but if it's supported everywhere, it looks like a good move.

have you looked at MSVC support? I have moved auto builds to MSVC15 in appveyor

argakiig yeah, it's a bit too soon still for msvc - see C++17 section at https://en.cppreference.com/w/cpp/compiler_support

We should probably wait with the move until we can rely on VS 17.

If #1439 is merged, update locks used by rpc_stats_objects_generated to use std::scoped_lock

@cryptocode It seems MSVC17 now has full support of C++17

@SergiySW Excellent! The question now is if commonly used LTS distros support it, as Colin noted above.

Debian 9 Stretch - GCC 6.3 (no)
Debian 10 Buster (release estimated mid-2019) - GCC 8.2 (yes)
Ubuntu 16.04 LTS - GCC 5.3 (no)
Ubuntu 18.04 LTS - GCC 7.4 (yes, except Elementary string conversions & std::filesystem)
RHEL 7 / CentOS 7 - GCC 4.8 (no)
RHEL 8 beta / CentOS 8 (mid-2019 ?) - GCC 8.2 (yes)

Nice overview @SergiySW. So I guess it's still too early, not sure we can always ask to upgrade GCC in the (no) cases.

Some Linux distribution C++17 support (recent versions):

  • Debian 10 Buster - GCC 8.3 (yes; except Polymorphic memory resources, Standardization of Parallelism TS)
  • Ubuntu 18.04 LTS - GCC 7.4 (yes; except Elementary string conversions, std::filesystem, Polymorphic memory resources, Standardization of Parallelism TS)
  • Ubuntu 20.04 LTS (April 2020) - GCC 9.2 (yes)
  • RHEL 8 / CentOS 8 - GCC 8.2 (yes; except Polymorphic memory resources, Standardization of Parallelism TS)

https://en.cppreference.com/w/cpp/compiler_support

Was this page helpful?
0 / 5 - 0 ratings

Related issues

FndNur1Labs picture FndNur1Labs  路  6Comments

AugustoResende picture AugustoResende  路  3Comments

yousifa picture yousifa  路  5Comments

sacreman picture sacreman  路  6Comments

BitDesert picture BitDesert  路  6Comments