STL headers problem
Nathan Myers
ncm@cantrip.org
Wed Jul 22 16:13:00 GMT 1998
Jordi de Antonio wrote:
> Sorry for the following newbie question:
> What's the difference between header files whit '.h' and without (p.e.
> <vector.h> and <vector>). I've always used '.h' one's, but now I'm
> having troube while porting the system to Visual C++ that doesn't have
> '.h' versions. I would like to know the difference before start to do
> changes.
Simple:
The <vector> headers are standard. The <vector.h> headers are not.
More complicated:
The <vector.h> headers are provided for backward compatibility, so
that when all your code which says (e.g.) "vector<int>" and not
"std::vector<int>" breaks with <vector>, you can continue to #include
the nonstandard <vector.h> and get your work done.
Of course nonstandard code is not portable. Unfortunately, even standard
code is not portable to a non-standard-conforming implementation such as
VC++. Unfortunately, released versions of gcc are not compatible with
standard code, and the standard-conforming rewrite of the library is not
ready yet. Everybody's working hard to get up to the standard, so these
problems will be temporary, but that doesn't make them any less grave at
the moment. Sorry.
In the "rewrite" the standard headers are all in one directory, and the
nonstandard headers are in other directories, so there can be no confusion
about which is which. There are still a lot of nonstandard features
scattered about in the standard headers, but they will be guarded with
#ifdef's, so you can tell they are not standard and protect yourself
against depending on them.
Nathan Myers
ncm@cygnus.com
More information about the Gcc
mailing list