Topic: Elimination of.h
Author: "Zac Bond" <zacwbond@hotmail.com>
Date: 2000/09/24 Raw View
In the new C++ standard, the library header files no longer have .h
extensions.
Why was this done? Should I remove the .h from my header files as well?
-Zac
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: James Kuyper <kuyper@wizard.net>
Date: 2000/09/24 Raw View
Zac Bond wrote:
>
> In the new C++ standard, the library header files no longer have .h
> extensions.
>
> Why was this done? Should I remove the .h from my header files as well?
I'm not sure of the precise reason, but it had more to do with issues of
style than issues of necessity. The main thing to worry about is whether
there's anything which depends upon the ".h" extension. The C++ standard
says no more about ".h" than the C standard. Even the old C89 standard
was silent on this issue.
In the environments where I've worked, there are two main reasons for
using ".h": some application developement systems recognise ".h" as
special. Secondly, some editors automatically go into a special mode
that's convenient for editing C code when editing files with extensions
of .c or .h. Neither of those reasons has anything to do with the C
standard, per se.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: Jim Cobban <jcobban@magma.ca>
Date: 2000/09/25 Raw View
This is a multi-part message in MIME format.
--------------E88051F10CBDD220643D7885
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Zac Bond wrote:
> In the new C++ standard, the library header files no longer have .h
> extensions.
>
> Why was this done? Should I remove the .h from my header files as well?
The primary contributers to computer language standards are the implementors
of compilers. These are representatives of corporations who are in business
to make money. To make money they need to minimize their implementation
costs while making their products as attractive as possible to their
customers. Their customers would not appreciate it if their existing
applications suddenly failed to compile under the new standard compliant
release of their compiler.
In the case of the C++ library headers there were a number of problems
involved in moving to the standard. One was the need to add
internationalization capabilities and real support for strings into the
IOStream library, something which was most effectively done by a substantial
redesign exploiting templates. However the new IOStream library was
fundamentally incompatible with some existing code. Another was the
introduction of namespaces, which meant that there needed to be a way for the
compilers to determine if the user wanted to use the old definitions without
namespaces or the new ones with namespaces. A third problem was that some
C++ implementors had used .hpp or .h++ or .hxx file suffixes for the C++
headers.
So the technique which was agreed upon to permit this migration was that
those headers whose behavior was defined by the standard would be invoked by
#include statements with specific identifiers. Note that the standard does
not specify how the compiler acts when it sees one of these identifiers.
They are not necessarily file names. I personally feel that those compiler
manufacturers who have implemented the new headers as filenames without the
suffix (you know who you are!) have missed the point, and are causing
problems for their customers who are using GUI interfaces (that is almost all
of us) because we can no longer just click on the file name and have the file
opened in the proper environment.
As to your own headers I would advise that you continue to identify them by a
..h suffix in order to permit viewing them easily through your GUI file
browser. In particular every class you define should have a Class.h header
file.
--
Jim Cobban jcobban@magma.ca
34 Palomino Dr.
Kanata, ON, CANADA
K2M 1M1
+1-613-592-9438
--------------E88051F10CBDD220643D7885
Content-Type: text/x-vcard; charset=us-ascii;
name="jcobban.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Jim Cobban
Content-Disposition: attachment;
filename="jcobban.vcf"
begin:vcard
n:Cobban;James
tel;fax:+1-613-592-9438
tel;home:+1-613-592-9438
x-mozilla-html:FALSE
url:http://www.magma.ca/~jcobban
version:2.1
email;internet:thesnaguy@hotmail.com
title:Consultant
adr;quoted-printable:;;34 Palomino Dr.=0D=0A;Kanata;ON;K2M 1M1;Canada
fn:Jim Cobban
end:vcard
--------------E88051F10CBDD220643D7885--
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: Phil Hibbs <philip.hibbs@tnt.co.uk>
Date: 2000/09/25 Raw View
Zac Bond wrote in message <8qjp4q$f90$1@slate.INS.CWRU.Edu>...
>In the new C++ standard, the library header files no longer have .h
>extensions.
>Why was this done? Should I remove the .h from my header files as well?
No! I think one of the reasons was to avoid conflicts between new standard
headers and existing user-written headers. If you have <vector.h> in your
own project, the introduction of <vector> will not break your code, neither
will the (hopeful) future introduction of <hash>.
Phil.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: "Per Velschow" <per@velschow.com>
Date: 2000/09/25 Raw View
> In the new C++ standard, the library header files no longer have .h
> extensions.
>
> Why was this done? Should I remove the .h from my header files as well?
It was done to distinguish the header files of the new ISO/ANSI Standard
from the old header files. You should most certainly use the new ones if
your compiler supports it. The old ones are deprecated and will probably
vanish at some time in the future (well... everything will vanish sometime
in the future, I guess).
Thus, instead of writing
#include <iostream.h>
you should write
#include <iostream>
One of the most visible differences between the old headers and the new
headers is that the new headers declare everything inside the namespace
'std'.
/Per
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]