ANSI C++ changes revisited

Eric Chamberland Eric.Chamberland at giref.ulaval.ca
Thu Apr 27 14:58:56 EDT 2000


Hey!

I do have problem with polution the global scope...

By the way, wouldn't you simply need a forward declaration in your
header files?  The you could do something like:

#ifndef NO_STD_COMPILER
#include <iosfwd>
#else
class ostream;
class istream;
...
#endif

Or you could to this in a vtk header file (vtkiosfwd.h).

For template files... you still have the problem...

If you want to do your "using std::*" in a source file, I don't mind,
but in a header file... we will have problem (since we use some
functions with the same name... like "endl"...).

Eric



Bill Hoffman wrote:
> 
> The only thing the using std::ostream in a header file does is
> cause errors if you try to use both <iostream> and <iostream.h>
> in the same file.   This will cause problems anyway.
> I don't think it is a problem to pollute the global
> namespace with ostream.   If you want to use the old iostream.h,
> then compile VTK for the non-ansi iostream.h.    If you named
> something else ostream, then you are asking for trouble.
> 
> The problem with vtkOstream is that reading the code becomes unclear.
> Is vtkOstream some new class?  Is it really ostream?
> The only thing we are preventing is using both the old and new in
> one application, which at least the microsoft compiler does not allow
> anyway.
> 
> At 02:16 PM 4/27/00 -0400, you wrote:
> >Hi,
> >
> >ok I understand the support for old compilers is necessary (we do have
> >to do this here, but they all support - or ignore, the std namespace...)
> >
> >But if you DO a "using std::ostream" in a headear file, one using
> >another "ostream" in is files (form another namespace) will have a
> >problem... so you will support the old compilers, but will cause
> >problems in the new ones.... :-)
> >
> >Maybe the "typedef std::ostream vtkOstream" solution isn't so bad....
> >
> >Or if we could us something like "#define std:: " it would be ok..
> >actually g++ simply "ignore" the std::, but I suppose they did a
> >workaround in the compiler itself...
> >
> >Eric

-- 
Eric Chamberland                   Eric.Chamberland at giref.ulaval.ca
2988 Pavillon Pouliot, GIREF       Tél.: (418) 656-2131 x6542
Université Laval, Canada, G1K 7P4  Fax : (418) 656-3404
--------------------------------------------------------------------
This is the private VTK discussion list. Please keep messages on-topic.
Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at public.kitware.com>. For help, send message body containing
"info vtkusers" to the same address.
--------------------------------------------------------------------



More information about the vtkusers mailing list