我的C ++程序使用哪个文件扩展名有关系吗? [英] Does it matter which file extension I use for my C++ programs?
问题描述
我正在使用Orwell Dev C ++ 5.8.3 IDE.它使用g ++ 4.8.1编译器.当我保存我的C ++程序文件时,它显示为几个文件扩展名,用于保存我的C ++程序文件,例如 .cpp,.cc,.cxx,.c ++ 、. cp
.
I am using Orwell Dev C++ 5.8.3 IDE. It uses g++ 4.8.1 compiler. When I am saving my C++ program files it shows to several file extensions for saving my C++ program files like .cpp, .cc, .cxx, .c++, .cp
.
选择哪个扩展名有关系吗?
Does it matter which extension I choose?
这些扩展是特定于编译器/IDE还是特定于平台的?
Are these extensions compiler/IDE specific or platform specific?
我正在使用Windows 7操作系统.
I am using windows 7 operating system.
这些扩展是否也可以使用和/或在Unix或Linux等其他操作系统上有效?
Are these extensions also available and / or valid to use on other operating systems like Unix or Linux?
为什么提供了这么多扩展程序?
Why there are so many extensions provided?
原因是什么?
推荐答案
该标准不要求C ++源文件采用任何格式,甚至允许编译器从一块手写代码的.jpeg图像中获取源代码.纸和编译.(有趣的读物)
The standard does not mandate any format for C++ source files, it even allows a compiler to get the source from a .jpeg image of handwritten code on a piece of paper and compile that. (Funny read)
但是,这样的编译器不存在(当然).大多数现实世界中的工具都可以与任何常规文件结尾(例如 .cpp
, .cc
或 .cxx
)配合使用,因此我建议不要用你的结局完全火腿.任何常规方法都同样不错,只要在项目中保持一致就可以避免混淆.
However, such a compiler does not exist (of course). Most real world tools would work best with any of the conventional file endings like .cpp
, .cc
or .cxx
, so I would suggest not to go completely ham with your endings. Any of the conventional ones are equally good, just stay consistent in your project to avoid confusion.
对于 .c ++
之类的东西,我也会有些小心.我不知道那里的每个系统是否都允许在文件名中添加这些内容.
I also would be a little bit careful with stuff like .c++
. I do not know whether every system out there allows such things in file names.
这篇关于我的C ++程序使用哪个文件扩展名有关系吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!