. C vs. CC vs. cpp vs. HPP vs. h vs. cxx [closed] From http://stackoverflow.com/questions/5171502/c-

Source: Internet
Author: User

Possible duplicates:
*. H or *. HPP for your class definitions
Correct C ++ code file extension? . CC vs. cpp

I used to think that it used to be that:

  • .hFiles are header files for C and C ++, and usually only contain declarations.
  • .cFiles are C source code.
  • .cppFiles are c ++ Source Code (which can also be C source code ).

Then files like.hpp,.cc, And.cxxCame along, and I got totally confused... what's the difference (s) between those? When do you use the "new" ones?

 

 

 

Historically, the first extension used for C ++ were. C and. h, exactly like for C. this caused practical problems, especially. C which didn't allows build system to easily differentiate C ++ and C files.

UNIX, on which c ++ has been developed, has case sensitive file systems. so some used. c For C ++ files. other used. c ++ ,. CC and. cxx .. C and. c ++ have the problem that they aren't available on other file systems and their use quickly dropped. DOS and Windows C ++ compilers tended to use. CPP, and some of them make the choice difficult, if not impossible, to configure. portability consideration made that choice the most common, even outside windows.

Headers have used the corresponding. H ,. h ++ ,. HH ,. hxx and. HPP. but unlike the main files ,. h remains to this day a popular choice for C ++ even with the disadvantage that it doesn't allow to know if the header can be encoded in C context or not. standard headers have now no extension at all.

Additionally, some are using. II ,. ixx ,. IPP ,. INL for headers providing inline definitions and. cxx ,. CPP ,. txx ,. TPP and. TPL for template definitions. those are either authorized ded In the headers providing the definition, or manually in the contexts where they are needed.

Compilers and tools usually don't care about what extensions are used, but using a extension that they associate with C ++ prevents the need to track out how to configure them so they correctly recognize the language used.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.