Swapping header/source in Visual Studio opens wrong file

Started by
9 comments, last by L. Spiro 9 years ago

It searches for .h, then for .hpp, then .hxx. .inl might be in the search too.
I’ve never used .hpp nor been on a project in they were used. The reason for using .hpp over .h is purely academic, not practical.

An academic reason for using .hpp is, “It lets people know that they are intended for C++.” People already know that. Your whole project is C++ with perhaps minor exceptions. It’s not a reason. And if they don’t know, I’m not sure how it is helpful to name it with a .hpp anyway. A simple glance at the code inside the file will tell anyone if it is C, C++, or mixed. Generally the intention of an include file to be used with a specific language is simply not high-priority knowledge for any programmer. We really don’t care to be notified that “this header is for C++”, especially when we already assume that based on the fact that we are working in a C++ project, or in a .CPP file, etc.

A practical reason to use .h is that it is simply the standard. Being a sheeple who just follows the heard in this respect provides practical benefits. You won’t have this Visual Studio® bug for example. You will never work on a project in a professional environment where people religiously use .HPP, so by using it you will only be confusing coworkers. You will likely be asked to stop. You may as well just break the habit now.

L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

This topic is closed to new replies.

Advertisement