C++ is a compiled, general-purpose programming language derived from C whose programs are stored as plain-text source and header files.
In format vocabularies the language is written out as CPlusPlus because many identifier schemes do not accept the plus sign.
Few languages have as many spellings for their own name as C++. Build systems say cxx, file names say cpp, compilers say c++, and metadata vocabularies often say CPlusPlus or cplus, because the plus sign breaks XML names and identifier rules. All of them point to the language Bjarne Stroustrup began at Bell Labs in 1979 as “C with Classes” and renamed C++ in 1983.
As a value in a format registry, C++ is the programming language behind a family of source-code formats. Linking a record to it lets a catalog list every C++ format together and sets it apart from Fortran, C or Java source that shares the same plain-text character.
The extension zoo
C++ never settled on one suffix, and the choice usually reflects the compiler culture a project grew up in.
.cpp: the most common today, standard in Microsoft Visual Studio projects..cc: frequent in Unix and Google-style codebases..cxx,.c++: older alternatives, still seen in CMake projects and scientific software..C(capital): a Unix convention that breaks as soon as the file lands on a case-insensitive file system, where it becomes indistinguishable from a C file..h,.hpp,.hh,.hxx: headers..ixx,.cppm: module interface units, introduced with C++20 modules.
For identification, this means a registry record for C++ source has to list several extensions, and an alias name list helps when catalogers search for “cxx” or “cpp files” instead of the formal label.
Headers and the C ambiguity
The .h suffix is the sore spot. A header can be pure C, pure C++ or deliberately both (wrapped in extern "C" guards). Signature-based identification cannot help much: like all source code, a C++ file is text with no magic number. Content heuristics look for class, namespace, template<, std:: or // comments, but // is legal in C since C99, and a header that declares three structs looks the same in both languages.
A practical rule in collections is to record what the surrounding project tells you: a header sitting next to .cpp files and built by a C++ compiler is C++ for catalog purposes, even when its own text is ambiguous. See the file format identification guide for how extension and content evidence are weighed.
Language versions are invisible
C++ is standardized by ISO/IEC 14882, with editions usually called C++98, C++03, C++11, C++14, C++17, C++20 and C++23. None of them changed the file format in any visible way. A registry can still describe “C++ source” as one format with versions, but the version can only be read from the build configuration or from features in the code (auto type deduction suggests C++11 or later, co_await suggests C++20).
What to keep with the source
Rebuilding C++ code years later depends on far more than the .cpp files. The compiler and its version, the build system files (CMakeLists.txt, Makefiles, .vcxproj), third-party libraries and the target platform all matter, and template-heavy code is notoriously sensitive to compiler differences. Generated files are a further trap: tools such as Qt’s moc or protocol buffer compilers write .cpp and .h files during the build, and a collection that keeps only the checked-in sources may be missing files that were never meant to be edited by hand but are needed to compile. Character encoding deserves a note too: older Windows projects often saved source in a legacy code page, and a comment in Windows-1252 turns into garbage when read as UTF-8. The vocabulary index lists the related registry concepts.
Example in RDF
@prefix ex: <https://example.org/vocab#> .
<https://example.org/formats/cpp-source>
ex:name "C++ source code" ;
ex:programmingLanguage ex:CPlusPlus ;
ex:extension "cpp", "cc", "cxx" ;
ex:internetMediaType "text/x-c++src" .
Questions about C++
Why is C++ written as CPlusPlus or cplus?
The plus sign is not allowed in XML element names, many programming identifiers or tidy URI paths, so vocabularies spell it out. CPlusPlus, cplus, cxx and cpp all show up as machine-friendly stand-ins for the same language.
Which extensions do C++ source files use?
Implementation files commonly use .cpp, .cc, .cxx or .c++, and an uppercase .C on case-sensitive systems. Headers use .h, .hpp, .hh or .hxx. Module interface units added in C++20 often use .ixx (Microsoft) or .cppm (Clang).
Is a .h file C or C++?
Either. The .h suffix is shared by both languages, and many headers are written to compile as both. Content clues such as class, namespace or template declarations point to C++, but a short header can be impossible to classify reliably.
What MIME type does C++ source have?
There is no IANA-registered type. The freedesktop.org shared MIME database uses text/x-c++src for source and text/x-c++hdr for headers, and many Linux tools follow it. Web servers often fall back to text/plain.
Which C++ standard does a file follow?
The file rarely says. The extension is identical for C++98 and C++23, so the standard has to be inferred from the build configuration (a flag such as -std=c++17) or from features used in the code.