This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: breaking compatibility


> Loren Osborn scribbles:
>
> I wish it were that easy... if it were I would just as soon just #include
> <istream.h> and be done with it... The truth of the matter is
> that we had to
> make and conform to certain #include-ing conventions to make all of our
> memory checking code work...
>
> our .cpp files generally begin with something like this:
>
> 	#include "Reflexive.h"
>
> 	// All required system includes here:
> 	#include <string.h>
>
> 	#include "Debug.h"
>
> 	// All required project includes here:
> 	#include "FileName.h"
> 	#include "OtherRequiredFiles.h"
>
> and our .h files are required to never include any system .h files...

The <iosfwd> header is part of the language.  If you're going to use the
istream part,
you should be willing to use the <iosfwd> part, since anything else (other
than including
<istream>) is pretty much guaranteed by the ISO standard to be non portable
(because
the library implementor is allowd to add additional parameters to the
templates.

If you have header files that depend on the istream template being declared,
you should
just include <iosfwd> in your .cpp file before any header(s) that reference
it.  The <iosfwd>
header contains ONLY forward declarations, not definitions (unlike
<istream>), so it shouldn't
cause any more problems than explicitly specifying the forward template
definition in your code.


Stephen M. Webb


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]