Thread View: comp.std.c++
4 messages
4 total messages
Started by Bret Pehrson
Fri, 17 Nov 1995 01:04
New STD header format (no extension), How come?
Author: Bret Pehrson
Date: Fri, 17 Nov 1995 01:04
Date: Fri, 17 Nov 1995 01:04
8 lines
907 bytes
907 bytes
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? --- [ 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. ]
Re: New STD header format (no extension), How
Author: 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. ]
Re: New STD header format (no extension), How
Author: Michael Cook
Date: Sun, 19 Nov 1995 09:21
Date: Sun, 19 Nov 1995 09:21
13 lines
1255 bytes
1255 bytes
>>>>> "SC" == Steve Clamage <clamage@Eng.Sun.COM> writes: SC> if a compiler previous used <iostream.hxx>, I would expect it to continue SC> to accept <iostream.hxx>, and pick up the same header file as <iostream>. Wasn't there some rule about `#include <foo>' being treated like `#include <foo.hxx>' followed by a bunch of `using' declarations? Michael. --- [ 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. ]
Re: New STD header format (no extension), How
Author: Steve Clamage
Date: Sun, 19 Nov 1995 19:19
Date: Sun, 19 Nov 1995 19:19
38 lines
2141 bytes
2141 bytes
Michael Cook <mcook@cognex.com> writes: >>>>>> "SC" == Steve Clamage <clamage@Eng.Sun.COM> writes: > SC> if a compiler previous used <iostream.hxx>, I would expect it to continue > SC> to accept <iostream.hxx>, and pick up the same header file as <iostream>. >Wasn't there some rule about `#include <foo>' being treated like `#include ><foo.hxx>' followed by a bunch of `using' declarations? No. You are probably thinking of the two forms of the headers which are inherited from Standard C. For example, <stdlib.h> and <cstdlib> <stdio.h> and <cstdio> <string.h> and <cstring> ... etc ... The <cxxx> form corresponding to <xxx.h> puts all the declarations in the "std" namespace. The <xxx.h> form, the form used in C, has those same declarations in "std" followed by using-declarations for each item. Thus, when you include <stdio.h>, the effect on the program is the same as in a C program. If instead you include <cstdio>, you can select the declarations you want by qualifying them explicitly or by employing individual using-declarations, or you could get all of them via a "using namespace std" directive. The standard headers specific to C++ have only one form defined in the standard, such as <new>, <iostream>, and so on. An implementation can supply whatever additional headers it likes, with whatever semantics it likes. -- 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. ]
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads