[Insight-developers] itkIPLCommonImageIO MSVC Warning 4284

Lorensen, William E (Research) lorensen at crd.ge.com
Mon, 26 Jan 2004 07:59:50 -0500


I added a pragma in the IPLCommonImageIO.cxx file to block the warning.

-----Original Message-----
From: kent williams [mailto:norman-k-williams at uiowa.edu]
Sent: Monday, January 26, 2004 12:15 AM
To: Julien Jomier; insight-developers at public.kitware.com
Subject: Re: [Insight-developers] itkIPLCommonImageIO MSVC Warning 4284


I'm not sure how one would fix this problem, as the warning arises because
of Visual Studio's confusion when it elaborates the std::list for
IPLFileSortInfo *.  It seems to be saying that a list must be either of
objects, or of references to objects, when it's obvious that a pointer to an
object is a perfectly fine thing to keep in a std::list.

I could revisit this code and change it to a list of references -- it'd be
easy enough. As of now we're not building with Visual Studio at Iowa,
though, so I'd only find out second-hand if we've muzzled MSVC6.

A few references to this error message -- mostly disparaging:

http://www.squid-cache.org/mail-archive/squid-dev/200307/0067.html

Here's a page that explicitly recommends disabling that warning with
pragmas; apparently this warning shows up frequently if you do anything with
STL and Visual C++.  Several Free/GPL packages whose source code is indexed
by Google do exactly this as a matter of course:

http://www.codeproject.com/vcpp/stl/stl_without_warnings.asp?print=true


----- Original Message ----- 
From: "Julien Jomier" <jjomier at cs.unc.edu>
To: <insight-developers at public.kitware.com>
Sent: Sunday, January 25, 2004 6:10 PM
Subject: [Insight-developers] itkIPLCommonImageIO MSVC Warning 4284


> Hi,
>
> This is not the first time I'm getting this warning with MSVC 6 when
> compiling ITK:
>
> [snip]
>
> itkIPLCommonImageIO.cxx
> C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\list(68) : warning
> C4284: return type for 'std::list<class itk::IPLFileSortInfo *,class
> std::allocator<class itk::IPLFileSortInfo *>
>::const_iterator::operator ->'
> is 'class itk::IPLFileSortInfo
>  *const * ' (ie; not a UDT or reference to a UDT.  Will produce errors if
> applied using infix notation)
>         E:\Workspace\Insight\Code\IO\itkIPLFileNameList.h(98) : see
> reference to class template instantiation 'std::list<class
> itk::IPLFileSortInfo *,class std::allocator<class itk::IPLFileSortInfo *>
>'
> being compiled
> C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\list(103) : warning
> C4284: return type for 'std::list<class itk::IPLFileSortInfo *,class
> std::allocator<class itk::IPLFileSortInfo *> >::iterator::operator ->' is
> 'class itk::IPLFileSortInfo ** '
>  (ie; not a UDT or reference to a UDT.  Will produce errors if applied
using
> infix notation)
>         E:\Workspace\Insight\Code\IO\itkIPLFileNameList.h(98) : see
> reference to class template instantiation 'std::list<class
> itk::IPLFileSortInfo *,class std::allocator<class itk::IPLFileSortInfo *>
>'
> being compiled
>
> [snip]
>
> Should we disable this warning (4284) for MSVC or try to fix it instead?
>
> Julien
>
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk.org
> http://www.itk.org/mailman/listinfo/insight-developers
>

_______________________________________________
Insight-developers mailing list
Insight-developers at itk.org
http://www.itk.org/mailman/listinfo/insight-developers