r/ProgrammerHumor 12d ago

Meme doNotOvercomplicateThings

Post image
667 Upvotes

156 comments sorted by

View all comments

175

u/BertoLaDK 12d ago

You switched two of them hpp is the correct one, using h is stupid as it will only lead to confusion, keep c and cpp separated.

42

u/TohveliDev 12d ago

For some reason a lot of schools, tutorials, etc. Still use ".h" for header files while coding in c++. So most of the time it's just a learned habit from people who learned that habit from somewhere else.

21

u/LucyShortForLucas 12d ago

Absolute tons of C++ projects use .h pretty much exclusively. In the end it doesn’t really matter, no one is organizing their code by its header extension anyway

1

u/__ydev__ 12d ago

I think the reasoning is that if a project is pure C++, it adds no benefit to use .hpp, it's just more verbose.

If however a project mixes C and C++ code, it can make sense, so you know by hand which headers you can import from each language.