[Paraview-developers] Re: [vtk-developers] Removed windows.h from VTK headers.

Sebastien BARRE sebastien.barre at kitware.com
Thu Dec 16 10:41:05 EST 2004


At 12/15/2004 10:11 AM, Brad King wrote:

>2.) A few virtual functions in VTK were renamed and replaced by
>   non-virtuals that forward their calls to a virtual internal
>   implementation.  User code calling these methods will not be
>   affected.  User code wishing to override these methods in a subclass
>   will have to rename to the internal name.  Such user methods will
>   also be exposed by the above mentioned CMake script.

I definitely like less compilation time, but what is the extent of that 
change, I mean, how much *hacking* is expected on a decent size project to 
make it work correctly with the new change ?

When I look at Widgets/vtkKWRenderWidget, I'm a little scared:

Instead of a single virtual RemoveProp (which I *know* is overriden in 
subclasses)

         virtual RemoveProp(vtkProp *prop)

We end up with "that" in the .h (and as you said, the RemoveProp is 
non-virtual, thus breaking the subclass):

#ifdef VTK_WORKAROUND_WINDOWS_MANGLE
   // Avoid windows name mangling.
# define RemovePropA RemoveProp
# define RemovePropW RemoveProp
#endif

   // Description:
   // Manage props inside this widget renderer(s). Add, remove, query.
   void RemoveProp(vtkProp *prop);

#ifdef VTK_WORKAROUND_WINDOWS_MANGLE
# undef RemovePropA
# undef RemovePropW
   //BTX
   // Define possible mangled names.
   void RemovePropA(vtkProp*);
   void RemovePropW(vtkProp*);
   //ETX
#endif

[...]
   virtual void RemovePropInternal(vtkProp* prop);

Ouch.
and that stuff in the .cxx:

//----------------------------------------------------------------------------
#ifdef VTK_WORKAROUND_WINDOWS_MANGLE
# undef RemoveProp
// Define possible mangled names.
void vtkKWRenderWidget::RemovePropA(vtkProp* p)
{
   this->RemovePropInternal(p);
}
void vtkKWRenderWidget::RemovePropW(vtkProp* p)
{
   this->RemovePropInternal(p);
}
#endif
void vtkKWRenderWidget::RemoveProp(vtkProp* p)
{
   this->RemovePropInternal(p);
}

This is not a great sight.

It's interesting because I remember 4 or 5 years ago we had a lot of 
discussons on how to speed up compilation time in the users list, on 
Borland and MSVC, and many people suggested solutions. At that time, I was 
not at Kitware already, but I wrote a Perl script that would significantly 
reduce compile time by detecting the headers that were most used, in what 
order, and would create a unique .h that could be pre-compiled/processed, 
yadi yada, a hack too which I'm glad did not make it through actually, but 
I think it was rejected because it introduced like... 2 or 3 extra-lines of 
#pragma in some headers, and also a global feeling that it was not too good 
to introduce that much compiler/system specific code in the source tree...

--
Sebastien Barre




More information about the Paraview-developers mailing list