C++ is regularly revised. The current set of proposals are under review. They are called C++20.
There are a few of the proposals that I'd like to try out.
Some simplify object handling. Other move algorithms from run-time to compile time solve.
Microsoft and GCC (and others) released a compiler that supports many of the preview options.
Check here for an overview of which compiler supports what.
Visual Studio 2019 Community Edition comes with the compiler built-in, if you select the Desktop Development with C++ workload.
By default, the preview options are disabled. Yoou can enable them by selecting your project properties, and navigate to:
Configuration Properties -> C/C++ / Language -> C++ Language Standard.
Then select Preview.
That's it. You can now write programs that use C++20 constructs.
For GCC, I used Eclipse 2020-12 for C/C++ developers as IDE and GCC 10.2.0 running in Cygwin64.
To install Eclipse, you download the zip and extract it.
To install the latest GCC in Cygwin, run its Setup program. Select GCC, then proceed to install version 10.2.0.
You can check the results:
$ cygcheck -c gcc-core gcc-g++
Start Eclipse, and create a new C++ Managed Build project.
For the first project, check the Cygwin settings.
Same as in Visual Studio, the C++20 constructs are disabled by default.
Navigate to Project - C/C++ Builod -> Settings -> Tool Settings -> Cygwin C++ Compiler -> Dialect.
Select ISO C++ 20
You can now write and debug code with the C++20 options.
Eclipse 2020-12 is not officially released. I witnessed some bugs:
- the editor screen sometimes shows warnings and errors while the compilation and build is clean.
- when debugging, at the end of the main program the debugger is somewhat confused if you step beyond the return().
None of these impact the fun.
There are more options that the two setups that I tried.
For the Raspberry Pi, BeagleBoard, Harting Mica, AVNET IIOT GateWay, ... fanboys
The GCC version 10 Windows cross-compiler that supports C++ 20 is now available:
Select this package: Windows (mingw-w64-i686) hosted cross compilers -> AArch32 target with hard float (arm-none-linux-gnueabihf).
Unzip it on your development windows PC, running the extractor program as administrator (so that symbolic links are properly replicated).
Then: build and debug your first GCC 10 Arm program from Windows and Eclipse.
In G++ Dialect, enable the c++20 options
You can now compile c++20 programs for your Raspberry Pi, BeagleBone, ...
image: a c++20 program running on the AVNET SmartEdge IIOT Garteway
Set the appropriate debugger executable in the debug configuration:
Voila.
Top Comments