Article View: comp.std.c++
Article #2628Re: New STD header format (no extension), How
From: Steve Clamage
Date: Fri, 17 Nov 1995 19:12
Date: Fri, 17 Nov 1995 19:12
43 lines
2585 bytes
2585 bytes
In article s2p@stellar.comnet.com, Bret Pehrson <BretP@strata3d.com> writes: >I have noticed that the new C++ standard library headers do >not include the traditional '.h' extension. > >Does anyone have any insight as to why this is? Many early C++ implementations used a file extension other than ".h" for header files. Choices included ".H", ".hpp", ".hxx", ".h++", and perhaps others. Looking at this problem in 1991, the C++ committee concluded that enshrining ".h" in the standard would be seen as discriminating against many implementations. It is the rule in Standard C that the names of the standard headers used in angle brackets need not correspond to the name of any file. That is, when you write <stdio.h>, there need not be any file in the system with the name "stdio.h". The implementation is free to map the reserved header name (in angle brackets) to anything -- it need not be a file at all, for example, but instead the reserved header names could simply enable declarations predefined inside the compiler. Or the implementation could map <stdio.h> to a file called "asdfghjkl" if it wished. The C++ committee decided in 1991 to make this point more obvious by eliminating the ".h" from the C++ standard header names, thus discriminating equally against all implementations. :-) Now you write, for example, <iostream>, and you might wind up getting a header file whose name is iostream.h, iostream.H, iostream.hpp, iostream.hxx, iostream.h++, or "zxcvbnm". (Or perhaps the implementation doesn't use actual files.) For compatibility, I would expect implementations to continue to accept the same spelling of standard headers that they always accepted. Thus, if a compiler previous used <iostream.hxx>, I would expect it to continue to accept <iostream.hxx>, and pick up the same header file as <iostream>. --- Steve Clamage, stephen.clamage@eng.sun.com --- [ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu. Contact address: std-c++-request@ncar.ucar.edu. The moderation policy is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID:
<48ihah$mgf@engnews1.eng.sun.com>Path:
arc1-ca.pugleaf.net!128.32.155.1!mattReferences:
<48g1lj$s2p@stellar.comnet.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!128.32.155.1!matt From: clamage@Eng.Sun.COM (Steve Clamage) Newsgroups: comp.std.c++ Subject: Re: New STD header format (no extension), How Date: 17 Nov 1995 19:12:47 GMT Organization: Sun Microsystems Inc. Approved: matt@physics2.Berkeley.EDU (Matt Austern) Message-ID: <48ihah$mgf@engnews1.eng.sun.com> References: <48g1lj$s2p@stellar.comnet.com> Reply-To: clamage@Eng.Sun.COM NNTP-Posting-Host: physics2.berkeley.edu