Difference between revisions of "User:Dydzio/cpp standard upgrade"

From VCMI Project Wiki
Jump to: navigation, search
m
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
As of 22.06.2019 linux debian will receive next stable version soon and its GCC will upgrade from 6.3 to 8.3. Ubuntu 18.04 supports GCC 7.4, alex uses GCC 7.3.
+
As of 22.06.2019 - linux debian will receive next stable version in few weeks and its GCC will upgrade from 6.3 to 8.3. Ubuntu 18.04 supports GCC 7.4, [[https://wiki.vcmi.eu/User:AVS AVS]] currently uses GCC 7.3.
  
Scripting branch breaks VS 2015 compatibility by (bug/lack of C++ feature/whatever) in ERM parser. VS 2017 (MSVC 19.1x) has way better C++ support and there is almost no reason to still use 2015.
+
Scripting branch breaks VS 2015 compatibility by (bug/lack of C++ feature/whatever) in ERM parser. VS 2017 (MSVC 19.1x) has way better C++ standard support and there is almost no reason to still use 2015.
  
If we assume 7.3 as minimal supported GCC version then on GCC part we can use:
+
If we assume GCC 7.3 (GCC 7) as minimal supported GCC version then on GCC part we can use:
  
- full C++14
+
- full C++14 (also in GCC 6 if we do not want GCC 7 for some reason)
  
 
- almost full C++17, with exception of few features listed below, with optional examples of related standard library elements in braces:
 
- almost full C++17, with exception of few features listed below, with optional examples of related standard library elements in braces:
Line 21: Line 21:
 
* https://en.cppreference.com/w/cpp/compiler_support
 
* https://en.cppreference.com/w/cpp/compiler_support
 
* https://gcc.gnu.org/projects/cxx-status.html#cxx1z
 
* https://gcc.gnu.org/projects/cxx-status.html#cxx1z
 +
 +
 +
If we decide to use Visual Studio 2017 as minimum supported VS version then we can use:
 +
 +
- full C++14
 +
 +
- vast majority of C++17 (microsoft claims "full comformance but with bugs" in VS 2017)
 +
 +
Apart from cppreference page... full conformance overview for VS 2015/2017/2019 is available on https://docs.microsoft.com/en-us/cpp/overview/visual-cpp-language-conformance?view=vs-2019
 +
 +
Especially watch out for following stuff in Visual Studio 2017:
 +
 +
* Preprocessor misbehavior, especially using variadic macros - last C++11 conformance bug, fixed in VS 2019
 +
* Some bugs in advanced lambda usage, also fixed in VS 2019 - not directly C++17 related
 +
* std::is_constant_evaluated() not working - C++17 related
 +
 +
Other not working stuff in VS2017 (C++17 related):
 +
* [https://cplusplus.github.io/LWG/issue2221 LWG 2221 Formatted output operator for nullptr]
 +
* [http://open-std.org/JTC1/SC22/WG21/docs/papers/2018/p0961r1.html P0961R1 Relaxing the structured bindings customization point finding rules]
 +
* [http://open-std.org/JTC1/SC22/WG21/docs/papers/2018/p0969r0.pdf P0969R0 Allowing structured bindings to accessible members]
 +
* [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0588r1.html P0588R1 Simplifying implicit lambda capture]
 +
* [http://open-std.org/JTC1/SC22/WG21/docs/papers/2018/p0962r1.html P0962R2 Relaxing the range-for loop customization point finding rules]
 +
* [https://wg21.link/P0929R2 P0929R2 Checking for abstract class types]
 +
* [https://wg21.link/P1009R2 P1009R2 Array size deduction in new-expressions]
 +
* [https://wg21.link/P1286R2 P1286R2 Contra CWG DR1778]

Latest revision as of 19:58, 22 June 2019

As of 22.06.2019 - linux debian will receive next stable version in few weeks and its GCC will upgrade from 6.3 to 8.3. Ubuntu 18.04 supports GCC 7.4, [AVS] currently uses GCC 7.3.

Scripting branch breaks VS 2015 compatibility by (bug/lack of C++ feature/whatever) in ERM parser. VS 2017 (MSVC 19.1x) has way better C++ standard support and there is almost no reason to still use 2015.

If we assume GCC 7.3 (GCC 7) as minimal supported GCC version then on GCC part we can use:

- full C++14 (also in GCC 6 if we do not want GCC 7 for some reason)

- almost full C++17, with exception of few features listed below, with optional examples of related standard library elements in braces:

  • Polymorphic memory resources (<memory_resource>)
  • C++17 should refer to C11 instead of C99
  • Elementary string conversions (std::to_chars, std::from_chars, chars_format)
  • Standardization of Parallelism TS
  • File system library (std::filesystem)
  • Template argument deduction for class templates - only partial support, probably conforms to v1 / draft paper?
  • std::char_traits<char> and std::char_traits<wchar_t> in constant expressions.

There is no guarantee this is everything, travis CI should help. If somebody uses "not fully supported" feature on purpose he should let others know in PR description / slack etc.

Some sources:


If we decide to use Visual Studio 2017 as minimum supported VS version then we can use:

- full C++14

- vast majority of C++17 (microsoft claims "full comformance but with bugs" in VS 2017)

Apart from cppreference page... full conformance overview for VS 2015/2017/2019 is available on https://docs.microsoft.com/en-us/cpp/overview/visual-cpp-language-conformance?view=vs-2019

Especially watch out for following stuff in Visual Studio 2017:

  • Preprocessor misbehavior, especially using variadic macros - last C++11 conformance bug, fixed in VS 2019
  • Some bugs in advanced lambda usage, also fixed in VS 2019 - not directly C++17 related
  • std::is_constant_evaluated() not working - C++17 related

Other not working stuff in VS2017 (C++17 related):