ANSI C++ changes revisited

Bill Hoffman bill.hoffman at kitware.com
Thu Apr 27 12:11:44 EDT 2000


The problem is that we want to be able to support older compilers.
If we change everything to be std::ostream, then VTK will stop working
for several compilers.   The using allows the code to be the same for
both ansi and non-ansi compilers.  It is not quite as bad as using std,
as we are only brining in a few names from std.



At 11:46 AM 4/27/00 -0400, Eric Chamberland wrote:
>Hi,
>
>just a not about the "using std::ostream"...  You should NOT do this if
>it is in a header file, because any who include you header file will
>have the "using std::ostream" effctive for his files...  So in all our
>header files (and template files) we do simply write each method with
>std::ostream instead of doing a "using std::ostream".
>
>so you woould probably want do to :
>
>PrintSelf(std::ostream...); // in your header file
>
>and in you source you could do:
>using std::ostream;
>PrintSelf(ostream...)
>{
>}
>or 
>PrintSelf(std::ostream...)
>
>
>Eric
>
>
>
>Will Schroeder wrote:
> > 
> > Hi Folks-
> > 
> > Remember the changes I made yesterday with regard to ANSI C++ ? Well they're already obsolete. Bill Hoffman discovered a better way to do it late last night (and thanks to the VXL code).
> > 
> > What we did is to create new typedefs like "typedef std::ostream vtkOstream".
> > 
> > What we can do instead is: "using std::ostream;"
> > 
> > Fortunately, all is not lost, we still retain the changes due to include files, and creation of the vtkSystemIncludes.h, etc.
> > 
> > The implications are as follows: instead of having PrintSelf(vtkOstream...) we have PrintSelf(ostream...) like before, except this time if ANSI C++ is turned on, ostream is really std::ostream because of the "using std::ostream'". This means code writers don't have to worry about these special types.
> > 
> > Much humbler I'll be checking the changes in shortly (unless someone has a good reason not to!)
> > 
> > Will
> > 
> > --------------------------------------------------------------------
> > 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.
> > --------------------------------------------------------------------
>
>-- 
>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.
>-------------------------------------------------------------------- 

--------------------------------------------------------------------
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