View Full Version : What was rational to deprecating the .h extension in C++ header files

Jonas thomas
January 23rd, 2010, 02:26 PM
I have a silly question.
I understand that they had to differentiate old header files from new header file with standard updates.

What was the standards people thinking when they decided to drop the .h?
Less typing?
I would think that if you where looking to manage header files a better standard would have been to change every thing to .hh or .hxx instead. I suppose it's less typing,but if wanted i want to search for .h header files it's very easy..

It's something I've always been very curious about. Anyone have a link?

January 23rd, 2010, 04:37 PM
First, only the standard headers dropped the extension. Any non-standard header should keep the extension. Second, I guess it's just a way to tell apart standard headers from those that aren't. Also, without dropping the extension, you'd have a weird conflict with the C string.h header... (ok, you refer to it as "cstring", but the how to distinguish the file?)

January 23rd, 2010, 10:33 PM
nvteighen is spot on with his string.h example. Bjarne Stroustrup, the inventor of C++, in his book 'The C++ Programming Language', devotes some time to discuss this change and mentions the standard committee (for C++) running into 'compatibility issues' because of such overlaps, and hence dropping them. It's apparently no philosophical change really; just pragmatic.

January 23rd, 2010, 10:41 PM
...but if wanted i want to search for .h header files it's very easy..

All the standard C++ header files (the ones that you don't use the h with) are in /usr/include/C++. Convenient, one stop shopping. ;) Don't know if that's what you were referring to, but I thought I would whip it out there anyway. :D

Jonas thomas
January 25th, 2010, 03:31 AM
Thank you everyone for the response... This is all starting to make sense..