[Insight-developers] itkDefaultConvertPixelTraits consistency issues
Zachary Pincus
zpincus at stanford.edu
Fri Jan 13 17:58:31 EST 2006
Hi again,
I've got another little problem that I've run into while writing ITK
wrappers (which force the compiler to explore lots of otherwise
untouched nooks and crannies of ITK). This problem/question likely
also relates to elements of the C++ standard in which my knowledge
may be limited, so forgive me for any errors.
Anyhow, the issue is that the file Insight/Code/IO/
itkDefaultConvertPixelTraits.h contains the following block:
ITK_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(float)
ITK_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(double)
ITK_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(int)
ITK_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(char)
ITK_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(short)
ITK_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(unsigned int)
ITK_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(unsigned char)
ITK_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(unsigned short)
ITK_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(long)
ITK_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(unsigned long)
ITK_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(bool)
Note especially that traits are created for types 'char' and
'unsigned char'. Here's the rub -- some compilers treat 'char' as a
synonym for 'signed char' and others treat it as synonymous with
'unsigned char'. I believe that the C++ spec is silent on this point.
Anyhow, this means (I think) that for compilers of the latter type,
no traits are ever set up for 'signed char' types.
I would therefore suggest either adding a traits class for 'signed
char' to this file, or changing the ambiguous 'char' trait to 'signed
char'.
It this alright by everyone? Would there be negative consequences of
this change that I haven't anticipated?
Zach
More information about the Insight-developers
mailing list