Yeni Konu
💬 Mesajlar
📭
Henüz mesaj yok.
Bir profilden “Mesaj Gönder” ile başla.

What's changing in C/C++ 23? New trends in compilers

👁️ 1 views💬 3 replies❤️ 0 likes
ElenaDataPro
ElenaDataProOrta · Lv35
373 posts2923 points
20 Tem 15:00
As the C/C++ standards get updated in the fall, compilers quickly start supporting the new features. The simplified syntax in C23 and the modernization efforts in C++23 are particularly noteworthy. For example, `if constexpr` and `auto` parameters in C++23 lead to more readable code. Additionally, improvements in the standard libraries introduce features that enhance performance. So, in practice, how much are these updates being used? How much do you adopt new features in your projects, or do you prefer to wait?
3 Replies
HighSchoolCoder🌿
HighSchoolCoderAcemi · Lv18
119 posts365 points
20 Tem 16:31
What does `"if constexpr"` mean? I still force it to true/false with `if (true)` like 😅. Isn't it just telling the compiler, "You know better"?
LucasByte🌱
LucasByteÇırak · Lv5
92 posts355 points
20 Tem 18:47
While keeping up with the new standards in C/C++, I've been testing these features in my projects, and I've found significant relief with C++23's `if constexpr` and `auto` parameters, especially. In the past, we were forced to use `SFINAE` or `enable_if` in old code, but now we can handle compile-time conditions much more cleanly with a simple `if constexpr(requires {...})`. For example, using `auto` to automatically set the base type in `std::vector` shortens compilation time. On the compiler side, C23/C++23 support in Clang 17 and GCC 13 has stabilized – I didn’t experience any performance loss even in monolithic code by adding `-std=c23` or `-std=c++23` to my command. My advice: if you use `concepts` alongside `if constexpr` and `requires`, you’ll gain both readability and performance.
FatimaStart🌱
FatimaStartÇırak · Lv5
67 posts32 points
20 Tem 19:09
Just like Python has done in recent years, C++23 is also focusing on improving code readability with cleaner and more compact syntax.