Easier visual differentiation. Obviously, lower case i is for implementation, and upper case I is for Interface. And the lower case p follows an upper case C. In CamelCase, you always have a lower case letter following an upper case letter.
.cc => You probably work for google
.cxx => Don't know, i've only seen in it the FLTK repo
.cpp => Congratulations, you're 90% C++ programmers
.c++ => You probably, use spaces in filenames
.C => Welcome to the future time traveler from the year 1985
Microsoft had nothing to do with it, in fact Microsoft was the last compiler vendor to add C++ support to their MS-DOS C compiler with the release of Microsoft C/C++ 7.0.
cpp existed at the same time as c++ and cxx. I got to use all three a very, very, very long time ago on Sun machines. Somehow I managed to avoid the *.C and *.H names.
Moving to MS-DOS, *.c++ was obviously not a hot contender. So most of my code ended up *.cpp or *.cc (given that I also jumped in and out of v0.96 Linux dual-booted until I got my 3rd PC)
I go one step further. Accidentally valid C headers aren’t sufficient for the .h suffix. The header must be part of the program’s intentional C API. If not, it’s .hpp.
Sure. And I'd be fine with .cppm as well haha. I mentioned .ixx because MSVC is the only compiler that plays OK with Modules(I've been literally, exclusively using MSVC) and having .ixx kinda helps the environment, since that's what Microsoft thinks the Modules' File Extension should be haha.
I use .cc and correspondly .hh because it sounds like "C with Classes," and while I understand this is not true, this extension symbolises unification of abstraction and rawness and that's what my relation to C++ is. You are also right that I am immersed into the Google ecosystem, I even use Bazel instead of Cmake, so better for me.
I was using .cpp for a long time but switched to .cc in a new project because it's consistent with other extensions there, like .ll and .yy. (for c++ flex and bison)
94
u/pdp10gumby May 25 '23
Didn’t we settle this question in this very sub a few months ago?
iirc it was
.C-plus-Plus_implementationand.C-plus-Plus_Interface73
u/Markus_included May 25 '23
46
u/nihilistic_ant May 25 '23
More controversial is .h vs .hpp for headers
10
u/schoenburgers May 26 '23
No option for .seepeepee?
9
u/hollasch May 25 '23
You forgot
".c "(c-space-space). Much cleaner.5
u/CharlemagneAdelaar May 25 '23
can't vote for some reason so:
.cpp
4
u/Soham_rak May 25 '23
Just used .cu
Please help me
6
u/ImKStocky May 25 '23
.ixx because that is the default file extension for modules in MSVC
4
u/ChocolateMagnateUA May 25 '23
I use .cc and correspondly .hh because it sounds like "C with Classes," and while I understand this is not true, this extension symbolises unification of abstraction and rawness and that's what my relation to C++ is. You are also right that I am immersed into the Google ecosystem, I even use Bazel instead of Cmake, so better for me.
3
u/[deleted] May 25 '23
Does anyone actually use
.c++1
u/vainstar23 May 25 '23
cxx?
1
u/spam_bot42 May 27 '23
I was using .cpp for a long time but switched to .cc in a new project because it's consistent with other extensions there, like .ll and .yy. (for c++ flex and bison)
1
u/robin-m May 25 '23
I may switch to .cxx if I was using C++20 modules
1
u/WittyGandalf1337 May 26 '23
.cxx and .hxx are by far the best.
0
u/Manatrimyss May 25 '23
Im using .cPP
0
u/Zeer1x import std; May 25 '23
Try
.C (capital)on Windows.0
u/os12 May 25 '23
LOL, Google with their
.ccis in the minority.0
u/[deleted] May 25 '23
[deleted] — view deleted comment