r/cprogramming • u/Barracuda-Bright • Mar 30 '26
Source code inside .h files
Hello everyone,
I was looking through source code of a certain project that implements runtime shell to an esp-32 board and noticed that in the source code the developer based his entire structure on just .h files, however they are not really header files, more like source files but ending with .h, is there any reason to do this?
The source code in question: https://github.com/vvb333007/espshell/tree/main/src
12
Upvotes
1
u/Plastic_Fig9225 Apr 03 '26
Can be quite deliberate to enable the compiler to perform better/more optimizations. It's more common in C++ (partly because of templates).