if the reason they change iostream.h to iostream...

Started by
22 comments, last by alnite 20 years ago
is for a compatibility purpose, why didn''t they do that for other header files as well? Why do some header files require .h? Yes, I do find the .h tag is quite unnecessary.
Advertisement
Most of the headers I've used that are of the standard had prior .h counterparts. fstream is one that comes to mind right now. String has a string.h. math.h should be replaced with cmath and so on.

[edited by - nervo on March 29, 2004 9:54:44 PM]
Well, R2D22U2..
None of the standard headers in C++ require the .h extension.

If you write your own header or someone else supplies the header, you/they are free to give it whatever extension you/they feel like.
quote:Original post by SiCrane
If you write your own header or someone else supplies the header, you/they are free to give it whatever extension you/they feel like.
But why don''t they make it a standard too that the all header files shouldn''t have the .h extension? They did that with C++ standard header files.
It is important to note that string.h became cstring, which is completely different than string

string.h/cstring: strlen, strcmp, etc.
string: STL''s basic_string, string
quote:Original post by alnite
But why don''t they make it a standard too that the all header files shouldn''t have the .h extension?
If you want a real revolution, ask them to get rid of header files once and for all.
quote:Original post by alnite
But why don''t they make it a standard too that the all header files shouldn''t have the .h extension? They did that with C++ standard header files.

Why should they? If I want to call my headers "somefile.h" or even "somefile.cow", what right does the standards committe have to say that I can''t? The standards committee doesn''t have any jurisdiction over my private code libraries.
Why don''t they get rid of the .cpp extension as well?
They took off the .h for all of the standard C++ headers I believe, as others have mentioned. People still use .h because a) it''s a handy convention and b) C still uses .h.

The C++ standard doesn''t affect the C standard and lots of people still use C, you know. But most people use .h when making headers because it''s just plain useful.
quote:Original post by SiCrane
quote:Original post by alnite
But why don''t they make it a standard too that the all header files shouldn''t have the .h extension? They did that with C++ standard header files.

Why should they? If I want to call my headers "somefile.h" or even "somefile.cow", what right does the standards committe have to say that I can''t? The standards committee doesn''t have any jurisdiction over my private code libraries.
Well, that sounds like a valid reason.

@Roland
then there is no way of knowing which file is a C++ source.

This topic is closed to new replies.

Advertisement