Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#4 superset needs "signed char"

closed
nobody
None
5
2012-10-11
2008-07-22
jremillard
No
template<> struct superset<unsigned char,char> { typedef short type; };
template<> struct superset<unsigned char,unsigned short> { typedef unsigned short type; };
template<> struct superset<unsigned char,short> {

Hi,

I did not know this before today, but the compiler treats "char","unsigned char", and "signed char" as three different type.

I tried to make a CImg<signed char=""> and ran into some broken functions because superset is not declared for a "signed char" type. I did this rather than CImg<char> because i did not want it to switch to signed /unsigned based on a compiler switch.

Anyway, need another set of these for "signed char".

Thanks
Jason.

typedef short type; };
template<> struct superset<unsigned char,unsigned="" int=""> { typedef unsigned int type; };
template<> struct superset<unsigned char,int=""> { typedef int type; };
template<> struct superset<unsigned char,unsigned="" long=""> { typedef unsigned long type; };
template<> struct superset<unsigned char,long=""> { typedef long type; };
template<> struct superset<unsigned char,float=""> { typedef float type; };
template<> struct superset<unsigned char,double=""> { typedef double type; };
template<> struct superset<char,unsigned char=""> { typedef short type; };
template<> struct superset<char,unsigned short=""> { typedef int type; };
template<> struct superset<char,short> { typedef short type; };
template<> struct superset<char,unsigned int=""> { typedef long type; };
template<> struct superset<char,int> { typedef int type; };
template<> struct superset<char,unsigned long=""> { typedef long type; };
template<> struct superset<char,long> { typedef long type; };
template<> struct superset<char,float> { typedef float type; };
template<> struct superset<char,double> { typedef double type; };

Discussion

  • Logged In: YES
    user_id=923846
    Originator: NO

    Hi Jason,
    You are absolutely right. I've added the necessary traits for 'signed char' support in CImg.
    It is in the latest CVS commit of CImg.h ( revision 1.1920 ).
    Thanks for pointing this out to me !

    David.

     
  • jremillard
    jremillard
    2008-07-22

    Logged In: YES
    user_id=1151426
    Originator: YES

    Hi David,

    I was quite surprised that "char" != "signed char" as far as the C++ types are concerned!

    Thanks
    Jason.

     


Anonymous


Cancel   Add attachments