문제

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.

도움이 되었습니까?

해결책

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.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top