.h file extension
Dear All,
Can anybody tell me, why is it recommended by std C++ to use the header files without .h extension over .h extension ??
e.g use :- #include <iostream> over #include <iostream.h>
Waiting for the Reply.
Thanks in advance.
Best Regards,
Saurabh.
# 1 Re: .h file extension
I dont know why they removed the extension but the ones without the .h are modernized (stl compatible and in std namespace) while the .h ones are older.
jonnin at 2007-11-11 21:02:49 >

# 2 Re: .h file extension
Let's not confuse two concepts: user's header files and standard files. The "recommendation" applies only to the latter. User header files, e.g. "myclass.h" should still have the same extension that's required by the implementation you're using, e.g., .h, .hpp and so on.
The standard headers don't have .h anymore because they are not required to be physical files. Theoretically, they could be stored in the system's RAM or be generated on demand. The standard's committee voted for the .h-less headers for another reason, namely distinguising between outdated and deprected headers and those that are standard compliant. iostream.h vs. iostream is a classic example. Finally, the .h causes confusion with C headers. Take string.h for instance. Is this the C header that contains strcmp etc. or the C++ one? So it was decided to use a C++-unqiue naming convention.
Danny at 2007-11-11 21:03:49 >
