â
id:kikx:20061106
ã®ç¶ã
short x = 1; unsigned char y = 1; issigned(x) ==> 1 issigned(y) ==> 0
ã¿ããã«å·¦è¾ºå¤ã ã£ããã
int issigned_data = -1; #define issigned_char(x) ((&x)[(int)&issigned_data-(int)&x] < 0) #define issigned(x) (sizeof(x)==sizeof(char)? issigned_char(x): ...)
ã¨ããã£ã¦ã左辺å¤ããã¤ã³ã¿ã«ãã¦ã-1ãè©°ã¾ã£ã¦ãã¨ãã¾ã§å¹³è¡ç§»åãã¦ãèªãã§ããã°ãã³ãã©ãªã«ä¿åããªãã¦ãã§ãããã ããªã