简体   繁体   English

为什么有些项目在c ++中选择源文件.cc的扩展名?

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

任何原因,什么是.cc

C++ is the ultimate language of choice and flexibility and C++ developers like to be different. C ++是最终的选择语言和灵活性,C ++开发人员喜欢与众不同。 The .cc extension is just one of the many that people choose for header and source files. .cc扩展名只是人们为标题和源文件选择的众多内容之一。 Some others I've seen. 我见过的其他一些人。

  • No extension: Popular with header files 没有扩展名:受头文件的欢迎
  • .h 。H
  • .hpp .HPP
  • .cpp 的.cpp
  • .cc .CC
  • .c 。C
  • .C (explicit capital on case sensitive file systems) .C(区分大小写的文件系统的显式资本)
  • .cxx .CXX
  • .inl (for inline templates) .inl(用于内联模板)

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. 扩展所带来的唯一真正效果是在争论最佳使用时,在一两天内消除团队的生产力。

I'm not aware for a deep reason for it other than that the string "c++" makes a poor extension on many OSes. 除了字符串“c ++”在许多操作系统上的扩展很差外,我不知道它的深层原因。 :-) 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最初可能是对“C with Classes”的引用,但这是我的猜测(也许是Joe的)。

.cc , .cpp , and .cxx are all common extensions for C++ source files. .cc.cpp.cxx都是C ++源文件的常见扩展。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM