Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between C header files (.h) and C++ header files (.hpp)?

Tags:

c++

c

I noticed that the boost library uses header files of (.hpp).
I am curious since most source files I see use normal .h header files.
Could there be any special instances which warrant use of .hpp instead of .h ?

Thanks

like image 789
Dr Deo Avatar asked Feb 11 '10 19:02

Dr Deo


2 Answers

Just convention, nothing special. You can use any extension on include files, actually.

like image 126
Otávio Décio Avatar answered Sep 28 '22 02:09

Otávio Décio


.hpp, .H, etc. is a loose convention for C++ header files, .tcc is a loose convention for C++ template implementation, .h is pretty strong convention for c files.

Boost uses hpp extension, QT uses .h extension, STL do not have extension. I am sure there are libraries which use .H but have not seen any.

like image 44
Anycorn Avatar answered Sep 28 '22 04:09

Anycorn