This is the mail archive of the libstdc++@sources.redhat.com 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: where is iostream.h, fstream.h, ...



Levente Farkas <lfarkas@mindmaker.hu>:
> brent verner wrote:
> >   Would it be sane to shipmake available a set of 'compatibility'
> >   headers similar to the following?
> > 
> > brent@sleepy$ cat ./iostream.h
> > #warning <iostream.h> is not a standard c++ header
> > #warning update this code to use <iostream>
> > #ifndef __NONSTD_HACK__
> > #define __NONSTD_HACK__
> > #include <iostream>
> > using namespace std;
> > #endif
[snip]
> I don't think it's a good idea since old header files are not 
> compatible with the new ones. it's not just a using namespace std;
> (eg. the old stream had some functions which the new hasn't).

Well, personally, I think the idea is good, but I agree with you that the
code would need to be much more strict in what it lets out.  Maybe start with

   #include <iostream>
   // some funky interaction with the new templatized iostreams here  :-(
   using std::istream;
   using std::ostream;
   ...
   using std::cin;
   using std::cout;
   using std::cerr;
   using std::clog;     // has this ever actually been used...?
   ...

inside the #warning/#ifndef/#define/#endif stuff.  (And I like having the
warning outside of the header guards, too.  :-)

Also, the only names exposed by 'using' could be those in the old iostream.h.
The new functions just remain "hidden" in std:: until the user asks for
them specifically.

I don't know whether such an iostream.h should be installed in the usual
search path or not.  Many pros and cons there.


Phil


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