C++ library for egcs

Martin von Loewis martin@mira.isdn.cs.tu-berlin.de
Fri Apr 10 07:27:00 GMT 1998


> The practice I'm most concerned about is that users tend to write
> 
> class ostream;
> 
> Historically this has been a wise thing to do -- compilation time on
> big projects is improved greatly if you do this, and the committee
> broke it.

How much of a real problem is this? In a compliant C++ library, this
declaration in itself is correct, even if you include <iostream>
later. 

The problem comes when they include <iostream.h>, as it will have a
using declaration for std::iostream. With a using directive, it would
be still correct. Of course, the problem comes later when you actually
use ostream, and it isn't defined.

I think there is no better way than telling users to include iosfwd.
If you use more than one compiler, you'd have to feature-test presence
of iosfwd in your code, anyway.

Martin



More information about the Gcc mailing list