[[ blog 이사 과정에서 정확한 posting날짜가 분실됨. 년도와 분기 정도는 맞지 않을까? ]]
'shift' operator in C extends sign bit.
int a = 0xffffffff; a = a>>8; // a == 0xffffffff
Due to sign of 'a' is minus, '>>8' preserve it's sign.
But, 'unsigned' value is always '>=0' So, sign bit doesn't need to be extended. So, front parts is filled with '0'.
unsigned int a = 0xffffffff a = a >>8; // a == 0x00ffffff
'Language > C&C++' 카테고리의 다른 글
[C/C++] virtual inheritance (0) | 2007.03.24 |
---|---|
[C/C++] Remind! Multiple-Inheritance of same-named-method from two classes. (0) | 2007.03.18 |
[C/C++][Tip] Using long and important 'enum'.. (0) | 2006.12.03 |
[C/C++][Tip] Macro... (0) | 2006.11.17 |
[C/C++] Unrolling loop. (0) | 2006.11.10 |