display | more...
Every programming language has a standard for naming its source files. Python does .py, Prolog (along with Poland and perl4) does .pl, C does .c for source and .h for interface, sh does .sh.

What about C++? Well, if ever you see any of the following extensions, know you're onto a C++ file (sorry, translation unit). Well, at least you might be...

NOTE: This list makes no pretenses of completeness!

  • .h for header files. No, really! Until the latest ISO C++ standard, the official approved way for standard headers was to steal the C name. Then they switched to something really ugly.
  • .cpp for source, .hpp for interface.
  • .cc for source. We usually don't use .hh for interface, that's just plain silly.
  • .C for source. No, not .c, we'd never dream of encroaching on another language's extension-space. Unless it's objective C, which, frankly, we don't regard as a language which exists. Although Objective C weenies claim their source code extension is .m. Maybe we can steal .m?

    BTW, that's a .C, with a Capital C. Oh, and .H for interface is Not Done. Dunno why.

  • .c++ for source, .h++ for interface (as before, the latter is less common).
  • .cxx for source, .hxx for interface. You see, we wanted to use .c++ and .h++, but our file system doesn't let us.

Log in or register to write something here or to contact authors.