>>>>> "Lars" == Lars Gullik Bjønnes <[EMAIL PROTECTED]> writes:
Lars> Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes: |
Lars> 1) add the proper 'using std::ostream' for all the objects like
Lars> this | that we use. The particular problem with ostream is that
Lars> it is or | is not in std:: depending on the header we use to
Lars> declare it...
Lars> One other problem with ostream (and string for that matter) is
Lars> that a conformant implementations uses templates for these and
Lars> thus you are not allowed to use a forward declaration in your
Lars> code. (e.g. class ostream; ) Luckily this problem is easy to
Lars> solve just add the correct inlcude file instead of using the
Lars> forward declaration.
Would that be alright with you to do the following:
1) in DebugStream.h, make sure that 'using std::ostream' is used (and
for other streams types we need too).
2) remove all explicit std:: for all stream types in DebugStream.[Ch]
3) for classes which define a << operator (commandtags...) define the
operator wrt DebugStream instead of ostream? This would make
definitions much cleaner (BTW, why does DebugStream.C include
debug.h and not DebugStream.h?)
I think this should be enough for now.
Lars> std::string and std::ostream is not what I am talking about when
Lars> saying "fun factor", is it more that using iostream is more fun
Lars> than C i/o. Using "using" at appropriate places is of course ok.
We agree, then.
Lars> My realy problem with "using std::ostream" in this specfic
Lars> context (debugstream) is that it pollutes the global
Lars> namespace...but perhaps that is of little concern... anyway this
Lars> would not have been a problem if we were allowed to put
Lars> debugstream inside a namespace.
The only problem is that we should not have a variable named ostream,
which is not a big deal IMO. Note that all the classes we do not use
do not pollute namespace, so we know what we are doing.
Lars> plain ostream is not an option (except for very short term), it
Lars> must be:
Lars> using std::ostream; ostream a;
Lars> or
Lars> std::ostream a;
I thought that if we used the 'old' streams (iostreams?), the classes
were declared at toplevel. At least I think that is what DEC cxx does.
JMarc