Pergunta

In the most tradition way, c/c++ uses .h for header file extensions. However, in the realworld usage (i.e. Visual C++), there are many other types of header files, such as: .hxx, .hh, .w, .idl, etc.

My question is, why people need different types of header files? I don't have a complete list of all the header types I saw, but please pick any case you familiar with and explain a bit.

Foi útil?

Solução

For the compiler there's no difference. You can use the extension that you want, or even no extension at all. So, .hh, .hxx, .my_awesome_extension are valid. The only important thing for the compiler is that it can find a file with the name you specify.

Outras dicas

The compiler don't care about the extension, but most of code-editors do and will switch to C++ mode if they encounter one of these extension.

For instance Emacs will use c-mode with .h extension while switching to c++-mode with .hpp extension.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top