The Evolution of C++ Keywords: From 1998 to 2023

The Evolution of C++ Keywords: From 1998 to 2023

Hello everyone! Today, we are going to discuss the historical changes of “keywords” in the C++ programming language. Don’t worry, if you’re a programming novice, I will explain everything in the simplest terms without bombarding you with a bunch of code.

First, what is C++? C++ is a super popular programming language used for writing software, games, apps, and more. It’s like a “foreign language” that has some special words called “keywords”. These words are the “reserved words” of the language, and programmers cannot use them as variable names (for example, you can’t name a variable “int”) because they have specific meanings, such as controlling program flow (if, for) or defining data types (int, bool).

Why do keywords change? Because C++ is not static; it updates every few years (like a phone system upgrade), adding new features to make programming more convenient and powerful. Each version may introduce new keywords or adjust the usage of old ones. Today, we will look at the evolution of keywords from C++98 to C++23 in chronological order. Let’s go!

C++98: The Starting Version (1998)

C++98 is the first international standard version, laying the foundation for C++. At this time, there were already many keywords, about 60, covering basic data types, control structures, and object-oriented programming.

  • New or Core Keywords: This version defined the core vocabulary of C++, such as <span>int</span> (integer), <span>if</span> (if), <span>for</span> (for loop), <span>class</span> (class), <span>bool</span> (boolean, true or false), <span>namespace</span> (namespace, used to avoid name conflicts), etc. There are also some alternative logical operators, such as <span>and</span> (and), <span>or</span> (or).
  • Novice Interpretation: Imagine C++98 as the foundation of a house, and these keywords are the bricks that allow you to build simple programs. For example, use <span>if</span> to evaluate conditions and <span>for</span> to repeat actions.

C++03 is a minor patch of C++98, with no significant changes, so we won’t discuss it separately.

C++11: Major Upgrade (2011)

C++11 was a major revolution for C++, modernizing the language and increasing programming efficiency. It introduced over 10 new keywords to help handle more complex problems.

  • New Keywords: <span>alignas</span> (memory alignment), <span>alignof</span> (query alignment), <span>char16_t</span> and <span>char32_t</span> (for handling Unicode characters), <span>constexpr</span> (constant expression, computed at compile time), <span>decltype</span> (type deduction), <span>noexcept</span> (no exceptions), <span>nullptr</span> (null pointer, safer), <span>static_assert</span> (static assertion, error checking), <span>thread_local</span> (thread-local storage).
  • Novice Interpretation: These new words make C++ smarter. For example, previously, null pointers used <span>NULL</span>, which could lead to errors; now we use <span>nullptr</span>, which is safer. <span>constexpr</span> acts like a “pre-calculator” to make programs run faster. C++11 allows novices to write efficient code!

C++14: Minor Optimizations (2014)

C++14 is a “patch version” of C++11, with no new keywords but adjustments to some usages. For example, <span>auto</span> (automatic type deduction) became more flexible and could be used in more places.

  • Changes: No new keywords, but the rules for old words like <span>auto</span> and <span>decltype</span> became more lenient.
  • Novice Interpretation: It’s like adding a small feature to a phone without changing the device, making it easier to use. Suitable for those who want to optimize code without major changes.

C++17: More Practical Focus (2017)

C++17 continued to optimize, with no new pure keywords but introduced new syntax (like structured bindings, which are not keywords). It made the code more concise.

  • Changes: No new keywords, but <span>if</span> and <span>switch</span> can use initialization statements.
  • Novice Interpretation: This version is like a “lazy mode” that allows you to write fewer lines of code. For example, previously, you had to define a variable separately before evaluating a condition; now you can do it in one step. Programming has become easier!

C++20: Concepts and Coroutines (2020)

C++20 is a major update that introduced advanced concepts like “modules” and “coroutines”, adding several new keywords to help write more modular code.

  • New Keywords: <span>char8_t</span> (UTF-8 character), <span>concept</span> (concepts for template constraints), <span>consteval</span> (constant evaluation), <span>constinit</span> (constant initialization), <span>co_await</span>, <span>co_return</span>, <span>co_yield</span> (coroutine-related, for asynchronous programming), <span>explicit</span> (extended usage), <span>export</span> (module export, previously deprecated, now revived), <span>import</span> (module import), <span>module</span> (module declaration), <span>requires</span> (requires expression).
  • Novice Interpretation: These words make C++ like building blocks. <span>module</span> and <span>import</span> help you divide your code into independent parts, making reuse easier. Coroutines (co_xxx) act like a “pause button”, suitable for writing games or network programs without stuttering. C++20 makes managing large projects easier!

C++23: The Latest Frontier (2023)

C++23 is the latest standard, focusing on refining existing features, with not many new keywords but optimizations in libraries and syntax.

  • Changes: No major new keywords, but there are some library extensions (like <span>std::print</span>), which are not core keywords.
  • Novice Interpretation: C++23 is like giving a house a fresh coat of paint, making it more aesthetically pleasing and practical. It is suitable for professional developers, but novices can also benefit from it, such as faster input and output.

Why is it important to understand these changes?

As a novice, you might wonder: I just learned C++, why should I care about history? Because the keywords of different versions affect code compatibility! For example, using C++11’s <span>nullptr</span> on an old compiler will result in an error. Understanding the history can help you choose the right version and avoid pitfalls. C++ is still evolving, and there may be more surprises in the future (for example, C++26 is in the works).

In summary, the evolution of C++ keywords is like a “growth diary” of the language, from basic to advanced, helping programmers solve more problems. If you want to get started, I recommend learning from C++11—it’s modern and not too complex. Feel free to share your learning experiences in the comments section, and let’s improve together!

Appendix: C++ Keywords by Version

Below is a simple table listing the new keywords (or major changes) for each major version. Note: C++98 is the starting point, and I have listed its core keywords as a baseline. The table is based on ISO standards and does not include all old keywords, only highlighting the changes.

Version New/Changed Keywords Simple Explanation
C++98 and, and_eq, asm, auto, bitand, bitor, bool, break, case, catch, char, class, compl, const, const_cast, continue, default, delete, do, double, dynamic_cast, else, enum, explicit, export, extern, false, float, for, friend, goto, if, inline, int, long, mutable, namespace, new, not, not_eq, operator, or, or_eq, private, protected, public, register, reinterpret_cast, return, short, signed, sizeof, static, static_cast, struct, switch, template, this, throw, true, try, typedef, typeid, typename, union, unsigned, using, virtual, void, volatile, wchar_t, while, xor, xor_eq Basic keywords covering data types, control flow, object-oriented programming, etc. export was later deprecated.
C++03 No new additions (minor patch) Basically the same as C++98, with no major changes.
C++11 alignas, alignof, char16_t, char32_t, constexpr, decltype, noexcept, nullptr, static_assert, thread_local Modern updates supporting better memory management, type deduction, and multithreading.
C++14 No new additions Optimized the usage of old keywords like auto and decltype, making them more flexible.
C++17 No new additions Adjusted if/switch, supporting initialization statements; introduced structured bindings (not keywords).
C++20 char8_t, concept, consteval, constinit, co_await, co_return, co_yield, explicit (extended), export (revived), import, module, requires Supports modularity and coroutines, making code more modular and asynchronous-friendly.
C++23 No new additions Optimized library functions (like print), with no new core keywords.

I hope this article helps you! 😊

Leave a Comment