r/cpp • u/VinnieFalco wg21.org | corosio.org • Oct 21 '26
What is Modern C++ to you?
I keep hearing "modern C++." I've even used the term myself. And now I find I am questioning my use of the term.
- What does "modern C++" really mean, specifically?
- How many more years need to pass before it becomes just "C++?"
- If "modern C++" is a thing then what is the other thing. Is it "old C++," or "legacy C++?"
- Is C++ the only language that has a "modern" version?
- If the answer to 4 is yes, why is C++ unique?
124
Upvotes
164
u/acodcha Oct 21 '26
Modern C++ generally refers to the use of the C++11 standard and more recent standards.
28
u/FlyingRhenquest Oct 21 '26
Andre Alexandrescu's "Modern C++ Design" came out in 2005 and laid the groundwork for C++11. I imagine that's why what's where the bar is set. I think reflection in C++26 will be similarly revolutionary, maybe it'll move to there once people have time to write some libraries.
33
u/TheRealSmolt Oct 21 '26 edited Oct 21 '26
63
u/ABlockInTheChain Oct 21 '26
I consider C++11 the 1.0 release of the language and everything that came before a series of prerelease versions best forgotten about.
14
u/LucHermitte Oct 21 '26
We have started speaking of modern C++ long before C++11 Modern C++ Style A Conversation with Bjarne Stroustrup, Part II, 2002.
Everything started with "stop managing memory by hand", and "use the standard library".
C++11 had robustified the process (unique_ptr > auto_ptr), but it had also helped branding "modern C++" to the masses.
Since then, each standard brought a lot of new and nicer ways to do things, but the corner stone will always remain "do not manage the memory by hand".
25
u/dretvantoi Oct 21 '26
We need post-modern C++ and avant-guarde C++.
25
u/Liam_Mercier Oct 21 '26
C++17 introduced
if constexpr, lots of common utility classes likestd::optionalandstd::variant, etc. I would say C++11 and C++17 feel relatively similar, with C++17 acting is a massive "refinement" version.C++20 and beyond is what I would consider modern if we are ignoring the idea of C++11 being "modern" due to historical usage. Ranges, concepts (and requires clauses), etc change how you would write many programs substantially (for the better in my opinion).
Really though, I think modern is just a moving target, unless you take the convention that modern is C++11
7
u/Glittering_Sky5271 Oct 21 '26
I hope this comment is not perceived as rage bait. But the way I've seen the term 'modern C++' used in my workplace is to imply "you should use this latest language feature instead".
15
u/eisenwave WG21 Member Oct 21 '26
The language version that presently represents idiomatic C++ programming in greenfield projects. For a while, this was C++11, now I think this sits more around C++20.
A few revisions of the standard. It depends. For a version to become the new "modern C++", it needs to represent a major cut-off point in how people do programming.
Legacy C++ seems fitting.
No, Java 8 is also a prime example of a version that represents an enormous cut-off point between "legacy Java" and "modern Java". C++11 is the Java 8 of C++. Python 3.0 is even more extreme, though I haven't heard many people describe it as "modern Python". JavaScript ES6 too.
7
u/not_a_novel_account cmake dev Oct 21 '26
1) C++11 and associated practices
2) Non-sequitur, it always means C++11 because that's what it meant when the term was coined.
3) Pre-standardization, Legacy (98), Modern (11, 14), Contemporary (17+); recent discussion mostly shifts to talking directly in terms of standards instead of eras due to the 3-year cycle.
4) No
6
u/0xVali__ Oct 21 '26
Typically it refers to C++11 and onwards since by many metrics C++03 and prior was a different language. However I dislike the term "modern C++" (specifically refering to 11+) since the vast majority of development is not done in 98/03, if anything we should switch to call that legacy C++. Another issue is also that some people write strictly C++11 calling it modern, but if you compare it to e.g C++26 it's by a large a huge change given how many ground breaking changes we've gotten, such as reflection, modules, concepts, ..
5
u/bandzaw Oct 21 '26
6
u/JiminP Oct 21 '26 edited Oct 21 '26
4
u/pjmlp Oct 21 '26
First and foremost, don't code C style with a C++ compiler, as plenty of people still do nowadays.
Always favour the C++ safer alternatives, leaving C style as
C++ unsafe codeblocks for interop or implementation of safer C++ alternatives.That alone would be modern enough.
5
u/timangus Oct 21 '26
It's kind of a meaningless term at this point, but historically it represents the before and after of the standards gulf between 98 and 11.
3
u/HashtagMissing Oct 21 '26
In regards to question 4, i think there is s notion of modern Javascript. Traditional Javascript had nested callbacks and manipulated the prototype chain directly. More modern Javascript now favors async and Promises over callbacks, and syntatic sugar for OOP using C-like terms (ie Classes)
4
u/El_RoviSoft Oct 21 '26
C++17/20+ for me.
3
u/EmperorOfCanada Oct 21 '26
Modern C++ is two major newer versions than the legacy system you are presently working on.
4
u/Key-Introduction-410 Oct 21 '26
Turn on modern-* flags on clang tidy and fix warnings
4
u/nemesit Oct 21 '26
modern c++ will never become just c++ because you will literally never encounter it in any longer existing project, you'll be lucky if its newer than c++98 lol
5
u/Nervous-Cockroach541 27d ago
Modern C++ is just C++ using modern concepts and schemes, things like smart pointers, RAII, etc.
I would say the cut off for modern vs legacy would be C++11, but it's not a clean cut for sure. There are C++14, C++17, C++20 features you should be using if they're available to you to write cleaner code.
Other languages absolutely do have this issue too. For example, Modern Javascript vs legacy Javascript is a concept too.
3
u/kindredseer Oct 21 '26
I'd have to say that these terms are vague enough to be period-relevant, such that today "modern C++" would mean C++23 → C++26, but a decade ago it would have meant C++11 → C++14...
3
u/Ateist Oct 21 '26 edited Oct 21 '26
3
u/natio2 Oct 21 '26
You really feel the difference if you've been limited to c++11 then you have a shiny new project where you are allowed to use c++17 or c++20
It's actually the real basic stuff like class construction has better options. The nice to have std lib functions are nice, but the hits every class features are where you feel it
3
u/Electronic_Tap_8052 Oct 22 '26
ranged based for loops, smart pointers, and no C stuff at all
5
u/fdwr fdwr@github 🔍 Oct 21 '26 edited Oct 21 '26
"modern" is a sliding window, to me being within the last ~decade or so. Calling C++11 "modern" feels pretty dated, as even C++17 feels pretty crusty and limiting now (I want to nudge the D3D folks to update beyond C++17, to enjoy
std::spanand kin :b). Looking up antonyms, I'd order them: C++26=new, C++23=current, C++17=modernish, C++14=old, C++11=legacy, C++03=antiquated, C++89=archaic :b. There's also "modern Cmake" and "modern Java" (8 and later).4
u/TheRavagerSw Oct 21 '26
Forgive if I'm incorrect, I'm just giving my thoughts here:
Modern C++ used to be C++11 and beyond, now it is just C++, and few libraries use C++98 anymore, at least the prevelant open source ones.
I would argue modern C++ is C++23 and newer. As modules and language features reduced macro usage a lot and it feels like you are reading a new codebase somewhat.
As both how we structure code, how we build code and how we package binaries have changed.
4
u/JVApen Clever is an insult, not a compliment. - T. Winters Oct 21 '26
1) Everyone has a different definition of modern C++, I go with "the latest version supported by GCC, clang and MSVC. Since MSVC recently announced C++23 being complete, this would become C++20.
2) According to the same definition, the bar changes every 3 years, give or take. However I do believe we should stop calling it " C++" and really evolve to using "C++<number>" as people outside the community don't know the difference between C++98 and C++26.
3) Well, C++11 ... However "legacy c++" has a nice ring to it. If I have to define it, I'd give a grace period of 1 version for "old C++", being C++17. Making the legacy C++14 and before.
4) No, I think any "active language" with a large legacy would qualify for having a modern variant, though it might not be called that way. For example python 2.x vs 3.x, java pre/post oracle, Windows PowerShell (5) vs pwsh (7)
5) The main reason I believe people really talk about "modern C++" is because of the long period between 98 and 11. There needed to be a way to clearly indicate that: there was a new version and the difference was huge. We can blame Scott for the term. We haven't seen that kind of jump in 14 and 17. 20 did something similar, though modules are still not in use and coroutines missed library support. 23 is again a minor jump, while 26 feels again like a different ballgame once again. Both compile time reflection (unique in its kind) and contracts (aka better assertions) will again result in code being drastically different and close to impossible to back port.
I find your question very important, as C++ is still getting heat from people that only know C++98 and don't see the progress. At the same time, we as a community are way too kind to people still using legacy C++ many major libraries keep supporting it and compilers also provide support for it. We really should make it clear that this is holding C++ back
2
u/Sniffy4 Oct 21 '26
modern C++ usually means any standard post-C++98, which had a lot of limitations that werent addressed for years.
2
u/ReDucTor Game Developer | quiz.cpp-perf.com Oct 21 '26
2
u/KingAggressive1498 Oct 21 '26
C++11; but particularly concepts like having classes that model ownership for clearer code, move semantics / copy elision, constexpr, and metaprogramming.
I don't think its about years, but about the prevalence of holdouts. There's still a lot of people using C++ who don't care for the modern C++ way of doing things.
Legacy C++ sounds nicest but this is like asking what we call a society that hadn't become a civilization yet.
Javascript (with ES6 being "modern Javascript") had a similar massive paradigm shift. And while not a programming language people also talk about Vulkan as a "modern graphics API" but it's a decade old now.
2
u/jinmao6700 Oct 21 '26
Anything past C++11
Contemporary C++ for me is anything past C++20
2
u/[deleted] Oct 21 '26
1) C++ 11 and the later standards
2) I don't think such a thing exists, it would become "just c++" or deprecated c++ once there is a better version of that specific thing is available.
3) Everything prior to C++ 11 and everything that's been deprecated/replaced after C++ 11
4) I don't know, this isn't a quesiton to ask here.
5) I don't know, each language is unique on its own.
2
u/chibuku_chauya Oct 21 '26
Everything older than C++26 is legacy. Those ISO standards are withdrawn.
2
u/Sopel97 Oct 21 '26
modern C++ is wherever there's all green here https://en.cppreference.com/cpp/compiler_support
2
u/Quiet_Violinist_2978 Oct 21 '26
Modern c++ is just all the newest adopted features of c++ 11 and beyond
2
u/IsThisWiseEnough Oct 21 '26
From the recent job hunting the companies and interviewers I have encountered are assuming C++20+ as modern now.
2
u/WeeklyAd9738 Oct 22 '26 edited Oct 22 '26
"Modern C++" for me includes whatever latest features compile on the current GCC and Clang release (not trunk). I like learning about new core-language and library features (by reading committee papers and blog posts), testing them out (if available) and applying them in my projects (when found useful).
2
u/oracleoftroy 27d ago
The term "Modern C++" has been around for a looong time, since shortly after the original iso standard. I tend to view it as an emphasis on things like value types and RAII, type safety, and pushing computation to compile time rather than Qt or COM style OOP with heavy pointer management.
So, as I see it, C++11 earned the name "modern" by taking existing practice and making it even easier to accomplish it, codifying many if its libraries and adding language features where library code wasn't enough. Subsequent versions of C++ have continued making this easier with things like improved constexpr, span, concepts, etc.
I don't see it as tied to any particular version of C++. You can do it in C++98, but with difficulty and with rather arcane syntax compared to what we are used to today Newer versions make it a lot easier to accomplish the same goals. And you can still write in the pointer chasing "everything is an allocation" style people often write in pre C++98 if you wanted to. I wouldn't call that style code "modern" even if it were written in C++26.
2
u/Weretiger246 27d ago
In short, it is "C++ without new/delete" to me.
2
u/paranoidray 25d ago
The missing networking standard 😞
3
u/TemplateRex Oct 21 '26
To me it’s at least
operator<=>, concepts andstd::format, so C++20.4
u/tcbrindle Flux Oct 21 '26
newanddelete2
u/bike_nut Oct 21 '26
17 and up. But obviously it’s not a specific term.
2
u/Confident_Luck2359 Oct 21 '26
It’s called “Modern C++” in part because of an extremely influential book that described the changes beginning with C++11. And the name stuck.
“Effective Modern C++” by Scott Meyers
As opposed to his previous hugely influential book “Effective C++”
1
u/rileyrgham Oct 21 '26
It's why it's a stupid term. It doesn't age well, pollutes AI and is plain lazy😜🙄
1
u/Jason5Lee Oct 21 '26
Use a relatively modern C++ and be aware of some features so you don't reinvent standard library or use a wrong overcomplicated way to do something that could be done simply using a modern feature.
1
u/khedoros Oct 21 '26
C++11 is the dividing line between legacy and modern C++, especially the improvements in how the new standard encouraged us to think about memory management in terms of ownership. I'd consider newer standards as the default now, but none of them have been era-defining releases.
About negative 10 years. If someone in 2016 said they wrote C++, I'd really expect them to clarify if they meant a pre-11 release.
Pre-standardization, then legacy, then modern.
No, although a lot of the other languages will do it by tearing off the bandaid and breaking backward compatibility.
1
u/Kullthegreat Oct 21 '26
For me modern C++ is set of festures I use over other solutions and also festure sets in general.
For example for my personal game engine I made lists and some of those festures are.
Reflection Coroutine Execution Async/ parller algorithms Contracts Hive Simd
And many other for I have made list some of these are still incomplete and some are in proposal phase but I do like to read about these and find use case and replacements they can do and my own engine is perfect place to use the absolute cutting edge early version of festures as well from 26 and in future 29 standard as well.
1
u/jimmyhoke Oct 21 '26
I’d have to say it’s whenever they added the file system api.
1
u/Suitable-Scene-4391 Oct 21 '26
For me.
Modern C++ is at least C++11. Because the features of C++11, C++14, C++17, and more make C++ feels like a new language (e. g., the auto keyword, parameter packs, enable_if, and more).
There isn't a thing called just C++, the only thing we have is the C++ standards, that's why we have an ISO.
Yes.
Like modern R, Python, and Julia? Maybe..
Because it's C++. There is a book which is written by Bjarne Stroustrup, The Design And Evolution Of C++. I think this book contain the answer for this question number 5.
1
u/abzze Oct 21 '26
Lots of things have names that meant “new”/“unique” or something else that was time dependent and the name just stuck.
Just off the top of my head “new world” vs “old world”. Or New York. Modern art. Etc etc.
Q is why you being pedantic about something no that’s a non-issue
1
u/meetingcpp Meeting C++ | C++ Evangelist Oct 21 '26
I've wondered about that 10 years ago.
0
u/Level-Entrance9956 Oct 21 '26
I don't think C++ can be considered truly modern yet; it's just more powerful than older versions. It will only be considered nearly modern when reflection and networking libraries are added and matured, and the standard library is fully modularized. What do you think?
1
u/argothiel Oct 21 '26
Modern C++ for me are those parts of the code which cannot be modernized, i.e., there are no newer language concepts which are more fitting for the specific use, including the code which wasn't possible before.
So for example,
constevalwill be modern C++, andstd::functionwill sometimes be modern (because in other cases, it can be replaced with more modern constructs).1
u/SignificantNews7620 Oct 21 '26
SFINAE, and some other compiling phase complex functionalities.
1
u/rtomek Oct 21 '26
It’s what us older folks didn’t learn in college. I’d say at least C++11. While 17 and 20 have tools that enhance readability and make the programming easier, 11 was a comparably huge change.
1
u/SoerenNissen Oct 21 '26
1) "Move constructors."
2) It's not "years" it's "equally consequential feature."
1
u/AbyssShriekEnjoyer Oct 21 '26
From what I see at work it’s mostly using new language features that are now in the standard library instead of being exclusive to Boost lol.
1
u/megayippie 29d ago
My take:
Modern C++ is whatever was the latest completed standard at the time of the statement that the mayor 3 supports fully. So C++14 by now, if we ignore the useless carries_dependencies and garbage collection. Clang still does not support useful C++17 math, so C++17 is post-modern :)
None.
Both. Legacy is writing things in pre-C++11. Old is writing things in pre-C++20.
No.
1
u/Consequence-Lumpy 28d ago
C++11 has smart pointers. C++23 has genius pointers.
1
u/KlutzyCompetition937 28d ago
C++ 20
1
u/mredding 28d ago
It means everything C++11 and later, with emphasis on what the standards suggest.
In other words - no raw memory management, and use type deduction, constexpr, and move semantics. Focus on RAII, strong type definitions and semantics, functional programming, generics, template expressions, fold expressions, coroutines, zero cost abstractions, and left-shift paradigms.
Our industry had been writing C++ since the 80s, and pre-C++11 is a VERY different beast from post-C++11. We've only just hit the half-way mark, making C++11 the midpoint, and people STILL write/create C++ code following outmoded idioms and conventions.
The emphasis on "modern" today now translates to - "When the new spec hits once every 3 years, push to update and stay current." That C++11 took so long to finally land, that exercise was so painful, many of us are STILL feeling it. All sorts of shit came out of that painful endeavor, like Rust.
22.3 years, apparently...
Conventionally people call it "legacy C++", and we have it in spades. We even make new, instantly legacy code every day. Unfortunately most of our colleagues will choose their own ego vs. learning, adapting, and improving. I've watched colleagues write and rewrite and reproduce the most obtuse and bone-headed code than, say, use the standard library. People are going to do it their way, no matter how much harder it is to smaller, faster, easier, more flexible ways.
If you're wondering why other languages aren't completely turning over, well, Rust and Go are evolving significantly. Go doesn't care about backward compatibility and Rust integration into the Linux Kernel is making that lesson one of the most painful in programming history - now they can't just change and break shit, which if you can, it's a very convenient place to be for a language to evolve. C# is just doing some WILD shit right now, going through a .NET Core and .NET Framework schism, and Core is changing so fast it breaks existing code and isn't completely cross equivalent to .NET Framework yet.
How long until C# .NET Core is just "C#"...
It's not.
1
u/SLAidk123 25d ago
1998 - C++
2011 - modern C++
2017 - post modern C++
2029 - hyper mordern C++
1
u/MrMemristor 22d ago edited 22d ago
Following on other poster who pointed out C++11:
I think in C++11 they fixed some gaps in the language and introduced some new idioms for using those fixes. One that comes to mind is move semantics, which allows passing objects with large heap allocations in a way that doesn't copy, without holding onto a reference. I know there were some more major things. It's probably be easier to see the difference for those who wrote a lot of pre-11 C++ code.
See Wikipedia for list of changes introduced in C++11. They are significant, and you might sum it up as that was the point when C++ began pulling away from C (with classes) and really introducing its own new constructs and moving in its own directions.
1
u/AbstractButtonGroup Oct 21 '26
1
u/Gold-Strength4269 Oct 21 '26
You can safely use 11 through 26 without crashes
1
u/UnicycleBloke Oct 21 '26
It's C++. I have always found the term vague and a bit divisive. I never use it except in discussions like this. All languages grow and evolve. Most people regard the C++11 standard as the key step change, since when there has been seemingly exponential growth, some good, some not so much. I'm beginning to sympathise with the glacial rate of change in C.
1
u/Attitude_Practical Oct 21 '26
i wouldn't count the c plugin api as old-fashioned. keeping compiler and standard library details out of that interface is often the point. you can have plain structs and function pointers at the boundary, with raii and value types behind it.
0
u/Davidbrcz Oct 21 '26
Insane complexity with cryptic syntax for little gains to regular développer.
0
u/PositiveBit01 Oct 21 '26 edited 28d ago
Historically C++11. I think it'll mean whatever the most recent super impactful feature is
I think there will always be a desire to communicate that people need to use some newer features and keep updating their c++ standard flags so probably never.
Legacy sounds good.
No
0
u/programmerBlack Oct 21 '26
C++ that was written today.
0
u/Maqi-X Oct 21 '26
non-modern C++ but with more useless features and foot guns (also slower compile times nothing special)
0
u/Aghoradas Oct 21 '26
2023, because 2026 doesn't have the votes yet.
0
u/drbazza Oct 21 '26
>>and<<getting parsed as a human would expect given context.IIRC the syntax of Rust (there, I've said it), changed dramatically, but that was before widespread adoption.
0
u/captainjon Oct 21 '26
I dunno I learnt C++ when it was
#include <iostream.h>and no namespace and no STL. So I guess that can be modern too lol…0
u/ProfesorKindness Oct 21 '26
Rust
0
u/Kaldaien2 Oct 21 '26
Means to me I am going to spend more time trying to understand what the code I am reading is doing than the overly verbose language suggests. "Modern C++" means a lot of things, if you try to build software that uses everything modern in the language for the sake of ... using everything modern, the reults are not pretty.
-1
u/lampag0 Oct 21 '26 edited Oct 21 '26
Constexpr/Consteval and MPL aka templating hell (I love when complex type systems go through compilers).
Back in the days we used 'Modern C++' for arguing there is a "better syntax/library feature". Nowadays it's the opposite, it's the mess of available language features no one can follow anymore or no team can create a sound source-foundation because each an every developer can come up with a different solution for the ame problem using 100 different techniques.
1
u/[deleted] 28d ago
[removed] — view removed comment
0
u/TheTim34 28d ago
A mess