Created
December 23, 2010 12:53
-
-
Save ownwaterloo/752932 to your computer and use it in GitHub Desktop.
difference in character types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void f0(int x); | |
void f0(signed int x) {} | |
void f1(char x); | |
void f1(signed char x) {} | |
void f2(char x); | |
void f2(unsigned char x) {} | |
void f(char* pc, int* pi) | |
{ | |
signed char* psc = pc; | |
unsigned char* puc = pc; | |
signed int* psi = pi; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<typename T, typename > | |
struct is_same_type { enum { value = false}; }; | |
template<typename T> | |
struct is_same_type<T,T> { enum { value = true}; }; | |
typedef int assert1[!is_same_type<char, signed char>::value? 1:-1]; | |
typedef int assert2[!is_same_type<char, unsigned char>::value? 1: -1]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment