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

Mathieu Coursolle mcoursolle at rogue-research.com
Fri Feb 23 09:47:42 EST 2007


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



More information about the Insight-developers mailing list