[Insight-developers] Enumeration type causes warning in XCode project

David Cole david.cole at kitware.com
Wed Feb 28 10:43:13 EST 2007


Another solution would be simply to cast the use of the enum values in
streaming expressions to avoid the warning. (Perhaps conditionally
based on some preprocessor definition.)

Casting at the point where the warning occurs would be a "less
intrusive" and more obviously backwards compatible change...

Yes?
David


On 2/23/07, Mathieu Coursolle <mcoursolle at rogue-research.com> wrote:
> Hi,
>
> We are currently using ITK in a Cocoa application build with XCode.
> However, we get lots of warning related to enumeration types when
> including some ITK headers.
>
> Ex: Warning: choosing 'int' over 'long unsigned int'
>
> This is mainly caused by the itkDebugMacro, which uses the << operator
> of the itk::OStringStream to display some enum values. It seems like
> the compiler does not see the same type as the << operator for those
> enum types.
>
> Enum types might cause some issues asa they might not be of the same type
> according to the compiler (32 or 64 bits for example).
>
> A solution to fix those issues and related warning would be to set the
> type to use for those enums:
>
> Ex:  typedef enum { ELEMENT1, ELEMENT2, ELEMENT3} MyEnum;
>
> can be written:
>
> enum { ELEMENT1, ELEMENT2, ELEMENT3};
> typedef int MyEnum;
>
> This causes MyEnum to be used as an int in all cases. I changed
> the ones in itkImageIOBase.h, itkGDCMImageIO.h and DICOMSeriesFileName.h
> to get rid of all the warnings I had.
>
> I would like to know if you would agree to commit such a change to
> enumeration types in ITK.
>
> Thank you.
>
> Mathieu
>
> --
> ____________________________________________________________
> Mathieu Coursolle                   mcoursolle at rogue-research.com
> Rogue Research                      www.rogue-research.com
> Montréal, Québec, Canada
>
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk.org
> http://www.itk.org/mailman/listinfo/insight-developers
>


More information about the Insight-developers mailing list