[Insight-developers] MRCImageIO & Visual Studio 6.0

Bradley Lowekamp blowekamp at mail.nih.gov
Tue Jun 15 09:57:13 EDT 2010


Bill did volunteer to look into this issue by using his version of the compiler.

It would not surprise me if VS6 was unable to compile any of the three suggested issues.

If the methods needs to be renamed I would suggest something along the lines:
 UpdateHeaderWIthMinMaxCaller
 UpdateHeaderWIthMinMaxDispatcher

But I am not able to think of how this convention is done else where, where a void argument is casted to it's specific type and another methods is called. So I don't know what we should really follow here.

Brad


On Jun 15, 2010, at 9:38 AM, Karthik Krishnan wrote:

> My understanding is that function templates must be inlined. Shouldn't the body of the method be moved from the CXX to the .H file ?
> 
> 
> On Tue, Jun 15, 2010 at 6:59 PM, Luis Ibanez <luis.ibanez at kitware.com> wrote:
> 
> mm, I'll take that back...
> 
> The method already is a templated member of the class.
> 
> Maybe the problem is the presence of the other non-templated
> function with the same name and with a (void *) as an argument.
> 
> 
>   template<typename TPixelType>
>     void UpdateHeaderWithMinMaxMean( const TPixelType * bufferBegin );
> 
>   void UpdateHeaderWithMinMaxMean( const void *buffer );
> 
> Would it make sense to rename the second one as something like:
> 
>   void UpdateHeaderWithMinMaxMeanGeneric( const void *buffer );
> 
> 
> for example?
> 
> 
>     Luis
> 
> 
> 
> --------------------------------------------------------
> 
> On Tue, Jun 15, 2010 at 9:26 AM, Luis Ibanez <luis.ibanez at kitware.com> wrote:
> Hi Brad,
> 
> VS 6.0 seems to be unhappy with the attempt of 
> using the template argument to the function:
> C:\Dashboards\My Tests\InsightContinuous\Code\Review\itkMRCImageIO.cxx(516) : error C2062: type 'unsigned char' unexpected
> 
> 
> 
> 
> http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/Review/itkMRCImageIO.cxx?root=Insight&r1=1.1&r2=1.2
> 
> 
> 
> 
> It looks like the next best option is to make that function 
> become a templated member method of a class.
> 
> 
> 
> 
> 
> 
>      Luis
> 
> 
> -------------------------------------------
> 
> On Mon, Jun 14, 2010 at 2:34 PM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
> I have VS6. I'll give it a go later today,
> 
> Bill
> 
> On Mon, Jun 14, 2010 at 2:15 PM, Bradley Lowekamp
> <blowekamp at mail.nih.gov> wrote:
> > Bill,
> > I have already committed a:
> > http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/Review/itkMRCImageIO.cxx?root=Insight&r1=1.1&r2=1.2
> > but unfortunately we are still getting related errors ( different but
> > related ):
> > http://www.cdash.org/CDash/viewBuildError.php?buildid=635501
> > It is likely the overloading of the method which is confusing the poor VS6
> > compiler:
> >
> >   // internal methods to update the min and max in the header based on
> >   // the data, in the image buffer to be written
> >   template<typename TPixelType>
> >     void UpdateHeaderWithMinMaxMean( const TPixelType * bufferBegin );
> >   void UpdateHeaderWithMinMaxMean( const void *buffer );
> > My suggestion would be to rename the second non-templated method. Perhaps I
> > should let some one with the VS6 compiler check to see if this is a working
> > solution instead of my prior shooting in the dark, which didn't solve the
> > issue.
> > Brad
> >
> >
> > On Jun 14, 2010, at 2:08 PM, Bill Lorensen wrote:
> >
> > I think we have done a) in the past.
> >
> > On Mon, Jun 14, 2010 at 1:11 PM, Luis Ibanez <luis.ibanez at kitware.com>
> > wrote:
> >
> > Hi Brad,
> >
> >
> > Visual Studio 6.0 seems to be having trouble with
> >
> > the template instantiations from itkMRCImageIO:
> >
> > http://www.cdash.org/CDash/viewBuildError.php?buildid=635480
> >
> >
> >
> > :\Dashboards\My Tests\InsightContinuous\Code\Review\itkMRCImageIO.cxx(516) :
> >
> > error C2893: Failed to specialize function template 'void __thiscall
> >
> > itk::Local::MRCImageIO::UpdateHeaderWithMinMaxMean(const TPixelType *)'
> >
> >        With the following template arguments:
> >
> >        'unsigned char'
> >
> >
> >
> > I believe that VS6 can't resolve templated functions
> >
> > just based on the type of the function argument.
> >
> >
> >
> > Options to consider are:
> >
> >
> > A)  instantiating it as:
> >
> >        f<T>( T arg )
> >
> > or
> >
> >
> > B)  Making that function to be a
> >
> >    templated method member of a class.
> >
> >
> > Do you have any preferences between these two options ?
> >
> > (or maybe other options...?)
> >
> >
> >
> >    Thanks
> >
> >
> >       Luis
> >
> >
> > _______________________________________________
> >
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> >
> > http://www.kitware.com/opensource/opensource.html
> >
> > Kitware offers ITK Training Courses, for more information visit:
> >
> > http://kitware.com/products/protraining.html
> >
> > Please keep messages on-topic and check the ITK FAQ at:
> >
> > http://www.itk.org/Wiki/ITK_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> >
> > http://www.itk.org/mailman/listinfo/insight-developers
> >
> >
> >
> > ========================================================
> >
> > Bradley Lowekamp
> >
> > Lockheed Martin Contractor for
> >
> > Office of High Performance Computing and Communications
> >
> > National Library of Medicine
> >
> > blowekamp at mail.nih.gov
> >
> >
> 
> 
> 
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Kitware offers ITK Training Courses, for more information visit:
> http://kitware.com/products/protraining.html
> 
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-developers
> 
> 

========================================================
Bradley Lowekamp  
Lockheed Martin Contractor for
Office of High Performance Computing and Communications
National Library of Medicine 
blowekamp at mail.nih.gov


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20100615/2b3a7ebb/attachment.htm>


More information about the Insight-developers mailing list