C++ officially supports a new platform: what it means for developers
The C++ developer community has received a long-awaited update: at the recent ISO C++ Committee conference, the expansion of official language support to a new hardware platform was announced. This involves the inclusion of full support for the RISC-V architecture in the C++ standard library and toolchain.
Previously, C++ supported RISC-V only partially, through the efforts of third-party developers and experimental compilers. Now, support becomes an official part of the specification, starting with version C++23. This opens up broad opportunities for developers to create high-performance and energy-efficient software for embedded systems, IoT devices, cloud servers, and even supercomputers.
What has changed?
- Standard Library: All major containers, algorithms, and I/O streams are now fully compatible with RISC-V.
- Compilers: GCC and Clang have received official backends for RISC-V with full support for optimizations targeting this architecture.
- Debugging and Profiling: Integration with popular tools (GDB, Valgrind, perf) now works "out of the box".
- Atomic Operations and Multithreading: Full support for std::atomic, std::thread, and parallel algorithms on RISC-V.
Why is this important?
RISC-V is an open Instruction Set Architecture (ISA) that is gaining popularity due to its flexibility, absence of licensing fees, and customizability. Major companies such as Google, Qualcomm, and NVIDIA are already actively investing in RISC-V. C++ support makes this platform even more attractive for developers of industrial software, operating systems, and drivers.
This is especially relevant for projects requiring a combination of C++'s high performance with RISC-V's low power consumption. For example, in the fields of autonomous drones, medical devices, or edge computing.
How to get started?
To experiment with the new support, simply install the latest version of GCC (12.2+) or Clang (16+) and specify the flag -march=rv64gc. Example of a simple program:
#include <iostream>#include <thread>
void hello() { std::cout << "Hello from RISC-V!" << std::endl;}
int main() { std::thread t(hello); t.join(); return 0;}This code will compile and run correctly on any RISC-V device, from microcontrollers to servers.
Prospects
It is expected that in the next year or two, we will see a significant increase in the number of C++ projects for RISC-V, especially in the open-source segment. Initiatives such as Apache TVM (a machine learning compiler) and Zephyr OS (an RTOS for IoT) are already actively porting their code to the new platform.
For educational resources like PythonLib, this means the emergence of new learning materials, courses, and practical tasks related to cross-platform development in C++. Stay tuned for updates — we will definitely cover practical examples of using C++ on RISC-V in upcoming articles.
Thus, support for the new platform is not just a technical update, but an important step towards the universality of C++, paving the way for innovation in a wide variety of fields.