C++: Reason why using ".hh" as extension for C++ header files
c++, header-files
Solution
Some say, we are using ".cc" as extension for C++ files to differentiate from C files (which has an extension ".c"), likewise we are using using ".hh" as extension for C++ header files to differentiate from C header files (which has an extension ".h").
That is exactly the reason. It is just to differentiate CPP headers from C headers.
Some programmers and libraries, such as Boost, use `.hpp` for CPP headers. My personal choice is this:
- example.c
- example.cpp
- example.h
- example.h++
Even if they all belong to a huge project, you can still figure out which one is which. No description is needed.
Problem
I would like to know why we use ".hh" as extension for C++ header files instead of using just ".h". The header files are preprocessed and the preprocessor doesn't even care about the extension of the header file. So, even if I create a header file with an extension ".qwe" (test.qwe). Then, why to use ".hh" as extension for C++ header files. Some say, we are using ".cc" as extension for C++ files to differentiate from C files (which has an extension ".c"), likewise we are using using ".hh" as extension for C++ header files to differentiate from C header files (which has an extension ".h"). I don't think this to be a valid reason. Does anyone know the reason for naming in such a way?