← posts

stop calling c++ headers .h

jul 22, 2023


Here's the short of it: if a header is meant only for C++, name it something.hpp. Leave .h for the rare files that really do compile under C as well.

Why I bother:

Nothing magical here — the pre-processor will gladly pull in sandwich.bun if you ask. This is just about not tripping up people and tools. Two extra letters, endless micro-wins.

Got mixed feelings? Keep the legacy .h files as-is. For anything new that's C++-only, stick with .hpp and call it a day.

That's it. Happy coding.