text
stringlengths
0
1.92k
Initially, Stroustrup's "C with Classes" added features to the C compiler, Cpre, including classes, derived classes, strong typing, inlining, and default arguments.[30]
In 1982, Stroustrup started to develop a successor to C with Classes, which he named "C++" (++ being the increment operator in C) after going through several other names
New features were added, including virtual functions, function and operator overloading, references, constants, type-safe free-store memory allocation (new/delete), improved type checking, and BCPL-style single-line comments with two forward slashes (//)
Furthermore, Stroustrup developed a new, standalone compiler for C++, Cfront.
In 1984, Stroustrup implemented the first stream input/output library
The idea of providing an output operator rather than a named output function was suggested by Doug McIlroy[2] (who had previously suggested Unix pipes).
In 1985, the first edition of The C++ Programming Language was released, which became the definitive reference for the language, as there was not yet an official standard.[31] The first commercial implementation of C++ was released in October of the same year.[28]
In 1989, C++ 2.0 was released, followed by the updated second edition of The C++ Programming Language in 1991.[32] New features in 2.0 included multiple inheritance, abstract classes, static member functions, const member functions, and protected members
In 1990, The Annotated C++ Reference Manual was published
This work became the basis for the future standard
Later feature additions included templates, exceptions, namespaces, new casts, and a Boolean type.
In 1998, C++98 was released, standardizing the language, and a minor update (C++03) was released in 2003.
After C++98, C++ evolved relatively slowly until, in 2011, the C++11 standard was released, adding numerous new features, enlarging the standard library further, and providing more facilities to C++ programmers
After a minor C++14 update released in December 2014, various new additions were introduced in C++17.[33] After becoming finalized in February 2020,[34] a draft of the C++20 standard was approved on 4 September 2020, and officially published on 15 December 2020.[35][36]
On January 3, 2018, Stroustrup was announced as the 2018 winner of the Charles Stark Draper Prize for Engineering, "for conceptualizing and developing the C++ programming language".[37]
In December 2022, C++ ranked third on the TIOBE index, surpassing Java for the first time in the history of the index
As of November 2024[update], the language ranks second after Python, with Java being in third.[38]
In March 2025, Stroustrup issued a call for the language community to defend it
Since the language allows manual memory management, bugs that represent security risks such as buffer overflow may be introduced in programs when inadvertently misused by the programmer.[39]
According to Stroustrup, "the name signifies the evolutionary nature of the changes from C."[40] This name is credited to Rick Mascitti (mid-1983)[30] and was first used in December 1983
When Mascitti was questioned informally in 1992 about the naming, he indicated that it was given in a tongue-in-cheek spirit
The name comes from C's ++ operator (which increments the value of a variable) and a common naming convention of using "+" to indicate an enhanced computer program.
During C++'s development period, the language had been referred to as "new C" and "C with Classes"[30][41] before acquiring its final name.
Throughout C++'s life, its development and evolution has been guided by a set of principles:[29]
C++ is standardized by an ISO working group known as JTC1/SC22/WG21
So far, it has published seven revisions of the C++ standard and is currently working on the next revision, C++26.
In 1998, the ISO working group standardized C++ for the first time as ISO/IEC 14882:1998, which is informally known as C++98
In 2003, it published a new version of the C++ standard called ISO/IEC 14882:2003, which fixed problems identified in C++98.
The next major revision of the standard was informally referred to as "C++0x", but it was not released until 2011.[48] C++11 (14882:2011) included many additions to both the core language and the standard library.[44]
In 2014, C++14 (also known as C++1y) was released as a small extension to C++11, featuring mainly bug fixes and small improvements.[49] The Draft International Standard ballot procedures completed in mid-August 2014.[50]
After C++14, a major revision C++17, informally known as C++1z, was completed by the ISO C++ committee in mid July 2017 and was approved and published in December 2017.[51]
As part of the standardization process, ISO also publishes technical reports and specifications:
More technical specifications are in development and pending approval.
The C++ language has two main components: a direct mapping of hardware features provided primarily by the C subset, and zero-overhead abstractions based on those mappings
Stroustrup describes C++ as "a light-weight abstraction programming language [designed] for building and using efficient and elegant abstractions";[15] and "offering both hardware access and abstraction is the basis of C++
Doing it efficiently is what distinguishes it from other languages."[71]
C++ inherits most of C's syntax
A hello world program that conforms to the C standard is also a valid C++ hello world program
The following is Bjarne Stroustrup's version of the Hello world program that uses the C++ Standard Library stream facility to write a message to standard output:[72][73][note 2]
The C++ standard consists of two parts: the core language and the standard library
C++ programmers expect the latter on every major implementation of C++; it includes aggregate types (vectors, lists, maps, sets, queues, stacks, arrays, tuples), algorithms (find, for_each, binary_search, random_shuffle, etc.), input/output facilities (iostream, for reading from and writing to the console and files), filesystem library, localisation support, smart pointers for automatic memory management, regular expression support, multi-threading library, atomics support (allowing a variable to be read or written to by at most one thread at a time without any external synchronisation), time utilities (measurement, getting current time, etc.), a system for converting error reporting that does not use C++ exceptions into C++ exceptions, a random number generator, and a slightly modified version of the C standard library (to make it comply with the C++ type system).
A large part of the C++ library is based on the Standard Template Library (STL)
Useful tools provided by the STL include containers as the collections of objects (such as vectors and lists), iterators that provide array-like access to containers, and algorithms that perform operations such as searching and sorting.
Furthermore, (multi)maps (associative arrays) and (multi)sets are provided, all of which export compatible interfaces
Therefore, using templates it is possible to write generic algorithms that work with any container or on any sequence defined by iterators.
As in C, the features of the library may be accessed by using the #include directive to include a standard header
The C++ Standard Library provides 105 standard headers, of which 27 are deprecated
With the introduction of modules in C++20, these headers may be accessed with import, and in C++23, the entire standard library can now be directly imported as module itself, with import std;
Currently, the C++ standard library provides two modules, std and std.compat (a compatibility module for std which exports C standard library facilities into the global namespace).
The standard incorporates the STL that was originally designed by Alexander Stepanov, who experimented with generic algorithms and containers for many years
When he started with C++, he finally found a language where it was possible to create generic algorithms (e.g., STL sort) that perform even better than, for example, the C standard library qsort, thanks to C++ features like using inlining and compile-time binding instead of function pointers
The standard does not refer to it as "STL", as it is merely a part of the standard library, but the term is still widely used to distinguish it from the rest of the standard library (input/output streams, internationalization, diagnostics, the C library subset, etc.).[74]
Most C++ compilers, and all major ones, provide a standards-conforming implementation of the C++ standard library.
The C++ Core Guidelines[75] are an initiative led by Bjarne Stroustrup, the inventor of C++, and Herb Sutter, the convener and chair of the C++ ISO Working Group, to help programmers write 'Modern C++' by using best practices for the language standards C++11 and newer, and to help developers of compilers and static checking tools to create rules for catching bad programming practices.
The main aim is to efficiently and consistently write type and resource safe C++.
The Core Guidelines were announced[76] in the opening keynote at CPPCon 2015.
The Guidelines are accompanied by the Guideline Support Library (GSL),[77] a header only library of types and functions to implement the Core Guidelines and static checker tools for enforcing Guideline rules.[78]
To give compiler vendors greater freedom, the C++ standards committee decided not to dictate the implementation of name mangling, exception handling, and other implementation-specific features
The downside of this decision is that object code produced by different compilers is expected to be incompatible
There are, however, attempts to standardize compilers for particular machines or operating systems
For example, the Itanium C++ ABI is processor-independent (despite its name) and is implemented by GCC and Clang.[79]
C++ is often considered to be a superset of C but this is not strictly true.[80] Most C code can easily be made to compile correctly in C++ but there are a few differences that cause some valid C code to be invalid or behave differently in C++
For example, C allows implicit conversion from void* to other pointer types but C++ does not (for type safety reasons)
Also, C++ defines many new keywords, such as new and class, which may be used as identifiers (for example, variable names) in a C program.
Some incompatibilities have been removed by the 1999 revision of the C standard (C99), which now supports C++ features such as line comments (//) and declarations mixed with code
On the other hand, C99 introduced a number of new features that C++ did not support that were incompatible or redundant in C++, such as variable-length arrays, native complex-number types (however, the std::complex class in the C++ standard library provides similar functionality, although not code-compatible), designated initializers, compound literals, and the restrict keyword.[81] Some of the C99-introduced features were included in the subsequent version of the C++ standard, C++11 (out of those which were not redundant).[82][83][84] However, the C++11 standard introduces new incompatibilities, such as disallowing assignment of a string literal to a character pointer, which remains valid C.
To intermix C and C++ code, any function declaration or definition that is to be called from/used both in C and C++ must be declared with C linkage by placing it within an extern "C" {/*...*/} block
Such a function may not rely on features depending on name mangling (i.e., function overloading).
Programs developed in C or C++ often utilize inline assembly to take advantage of its low-level functionalities, greater speed, and enhanced control compared to high-level programming languages[85][86] when optimizing for performance is essential
C++ provides support for embedding assembly language using asm declarations,[87] but the compatibility of inline assembly varies significantly between compilers and architectures
Unlike high-level language features such as Python or Java, assembly code is highly dependent on the underlying processor and compiler implementation.
Different C++ compilers implement inline assembly in distinct ways.
C++ provides two primary methods of integrating ASM code.
1
Standalone assembly files – Assembly code is written separately and linked with C++ code.[93]
2
Inline assembly – Assembly code is embedded within C++ code using compiler-specific extensions.
Minecraft is a sandbox game developed and published by Mojang Studios
Formally released on 18 November 2011 for PCs following its initial public alpha release on 17 May 2009, it has been ported to numerous platforms, including mobile devices and various video game consoles.
In Minecraft, players explore a procedurally generated, three-dimensional world with virtually infinite terrain made up of voxels
Players can discover and extract raw materials, craft tools and items, and build structures, earthworks, and machines
Depending on the game mode, players can fight hostile mobs, as well as cooperate with or compete against other players in multiplayer
The game's large community offers a wide variety of user-generated content, such as modifications, servers, player skins, texture packs, and custom maps, which add new game mechanics and possibilities.
Originally created in 2009 by Markus "Notch" Persson using the Java programming language, Jens "Jeb" Bergensten was handed control over the game's continuing development following its full release in 2011
In 2014, Mojang and the Minecraft intellectual property were purchased by Microsoft for US$2.5 billion; Xbox Game Studios hold the publishing rights for the Bedrock Edition, the cross-platform version based on the mobile Pocket Edition which replaced the existing console versions in 2017
Bedrock is updated concurrently with Mojang's original Java Edition, although with numerous, generally small, differences.
Minecraft is the best-selling video game of all time, with over 350 million copies sold (as of 2025) and 140 million monthly active players (as of 2021)
It has received critical acclaim, winning several awards and being cited as one of the greatest video games of all time; social media, parodies, adaptations, merchandise, and the annual Minecon conventions have played prominent roles in popularizing the game
The game's speedrunning scene has attracted a significant following
Minecraft has been used in educational environments to teach chemistry, computer-aided design, and computer science
The wider Minecraft franchise includes several spin-off games, such as Minecraft: Story Mode, Minecraft Earth, Minecraft Dungeons, and Minecraft Legends
A live-action film adaptation, titled A Minecraft Movie, was released in 2025, and became the second highest-grossing video game film of all time.
Minecraft is a 3D sandbox video game that has no required goals to accomplish, allowing players a large amount of freedom in choosing how to play the game.[5] The game also features an optional achievement system.[6] Gameplay is in the first-person perspective by default, but players have the option of third-person perspectives.[7] The game world is composed of rough 3D objects—mainly cubes, referred to as blocks—representing various materials, such as dirt, stone, ores, tree trunks, water, and lava
The core gameplay revolves around picking up and placing these objects
These blocks are arranged in a 3D grid, while players can move freely around the world
Players can break, or mine, blocks and then place them elsewhere, enabling them to build things.[8] The game also contains a material called redstone, which can be used to make primitive mechanical devices, electrical circuits, and logic gates, allowing for the construction of many complex systems.[9][10] Comparatively, the game's physics system has been described as unrealistic, with nearly all blocks unaffected by gravity.[11]
Players can also craft a wide variety of items, such as armor, which mitigates damage from attacks; weapons (such as swords or axes), which allow monsters and animals to be killed more easily; and tools (such as pickaxes or shovels), which break certain types of blocks more quickly
Some items have multiple tiers depending on the material used to craft them, with higher-tier items being more effective and durable
They may also freely craft helpful blocks—such as furnaces which can cook food and smelt ores,[12] and torches that produce light—or exchange items with a villager (NPC) through trading emeralds for different goods and vice versa.[13][14] The game has an inventory system, allowing players to carry a limited number of items.[15]
The game world is virtually infinite and procedurally generated as players explore it, using a map seed that is obtained from the system clock at the time of world creation (or manually specified by the player).[16][17][18] While there are limits on the world's verticality, Minecraft allows an infinitely large game world to be generated on the horizontal plane, though the player is limited to traversing up to 30 million blocks from the world's center.[19] The world is divided into biomes ranging from deserts to jungles to snowfields;[20][21] the terrain includes plains, mountains, forests, caves, and bodies of water or lava.[18] The in-game time system follows a day and night cycle, with one full cycle lasting for 20 real-time minutes.[22]