Home>Article>Backend Development> What is the extension of c++ source program files?

What is the extension of c++ source program files?

尚
Original
2020-04-20 16:22:46 19993browse

What is the extension of c++ source program files?

The C source program extension in non-UNIX systems is .cpp, and the commonly used C source program extension in Unix systems is .cc.

Different users use different solutions: .cc, .cpp, .cxx and possibly others. Today, outside of the Unix world, it's mostly .cpp. Unix seems to use .cc more often.

For header files, the situation is even more confusing: for whatever reason, the earliest C authors decided not to distinguish between header files for C and C++, and used their .h.

This won't cause any problems if you don't have C in your project, but when you start dealing with these two issues, it's usually a matter of distinguishing between header files that can be used in C (.h) and those that can't (.hh or .hpp).

Also, in C, many users (myself included) prefer to keep template sources and inline functions in separate files. Which, although strictly speaking a header file, will often be based on another set of conventions (.inl, .tcc and probably many others).

In the header file, it has no effect on the compiler.

For source files, different endings will cause the compiler to use different languages. But this can usually be overridden, and .cc is used with VC long before VC recognizes it as C.

The above is the detailed content of What is the extension of c++ source program files?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn