Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why some projects choose the extension for source files .cc in c++?

Tags:

c++

Any reason for that, what is .cc for?

like image 225
user198729 Avatar asked Aug 28 '10 00:08

user198729


2 Answers

C++ is the ultimate language of choice and flexibility and C++ developers like to be different. The .cc extension is just one of the many that people choose for header and source files. Some others I've seen.

  • No extension: Popular with header files
  • .h
  • .hpp
  • .cpp
  • .cc
  • .c
  • .C (explicit capital on case sensitive file systems)
  • .cxx
  • .inl (for inline templates)

Which to use is merely a matter of preference. There is no inherent gain from choosing one extension over the other.

The only real effect the extension has is to kill a team's productivity for a day or two while they debate the best one to use.

like image 131
JaredPar Avatar answered Nov 25 '22 05:11

JaredPar


I'm not aware for a deep reason for it other than that the string "c++" makes a poor extension on many OSes. :-) I believe these conventions developed before there was a standard, and because the language and compilers themselves generally don't ascribe any particular meaning to the extensions of the source files, no standard was ever necessary. .cc might originally have been a reference to "C with Classes," but that's speculation on my part (and maybe Joe's).

.cc, .cpp, and .cxx are all common extensions for C++ source files.

like image 24
Owen S. Avatar answered Nov 25 '22 06:11

Owen S.