Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

9
  • 6
    Eh, not really. .cpp has been the name of the C++ file extensions since the dawn of time. C++ compilers are often named something-cpp. I have never actually heard of the C preprocessor getting referred to as "cpp" however. In general it is referred to as "pp" and that's how the formal standard refers to it too, "pp-token" etc. That being said, I agree that "C++" would be a better name. Commented Nov 7 at 9:43
  • 2
    I'm pretty sure K&R's original preprocessor was called cpp (though I haven't actually checked) and GCC's is also called cpp, so that's a pretty continuous pedigree. I've never seen a compiler ending -cpp - in the GNU suite, those are always preprocessors. As to file names, .cpp, .C, .cc are all commonly used suffixes (recognised by Make's built-in rules), and I'm sure I've seen .c++ used in some codebases. Commented Nov 7 at 9:50
  • It's actually never referred to like that, other than maybe through the gcc URL leading to the preprocessor documentation. Notable from the very preprocessor documentation are the chapters. 4.2.7 __has_cpp_attribute and 4.2.8 __has_c_attribute, so not even the gcc preprocessor uses cpp to refer to the preprocessor, but to the C++ language. Commented Nov 7 at 9:54
  • 2
    Note that, as somebody who started programming in C before C++ even existed, and then switched over later, my understanding has always been that cpp refers to c plus plus. Commented Nov 7 at 12:04
  • 3
    The name of the language is "C++". That's how code blocks in that language should be labelled, not by one of the file extensions recognized for such code. Commented Nov 12 at 23:19
  • 1
    @Lundin, The C preprocessor is not only referred to as "cpp" in documentation and URLs. It is available by that name as a binary executable on many systems. POSIX does not appear to standardize that, but it's nevertheless very traditional. Speaking only for myself, I knew the C preprocessor as "cpp" long before I understood that the same symbol was sometimes used to refer to C++ in contexts that do not allow the '+' character to appear in identifiers. Commented Nov 12 at 23:29
  • 1
    In any case, the fundamental point here is that the label should identify the source language by its name, not by one of the filename extensions sometimes used for naming files containing source written in that language. Commented Nov 12 at 23:32
  • @JohnBollinger "cpp" was already used to refer to C++ back in 1990 and Borland Turbo C++ so the notation is hardly new; in fact it seems to have been around for as long as C++, pretty much. Yes, C existed before that, but the use of the abbreviation "cpp" has de facto meant C++ for some 35 years by now. As I mentioned, even the gcc preprocessor in itself uses that terminology. Any earlier use might exists but that's a story for retrocomputing.stackexchange.com and not relevant to this discussion. Commented Nov 13 at 13:00
  • 2
    @Lundin, I distinguish between the symbol "cpp" being used in source-language identifiers and it being used to name or refer to the language itself or compilers for it. At best, "cpp" is ambiguous, which is all the more reason not to use it as a label. And it is in any case uncontroversial that "cpp" is not the name of the language. Labeling C++ source as "C++" would be clearly superior to labelling it "cpp", notwithstanding any particular person's assessment of just how bad "cpp" is in that role. Commented Nov 13 at 14:48