C언어

cast from pointer to integer of different size

고요한하늘... 2008. 8. 19. 18:10

32비트 머신에서는 warning 없이 잘 컴파일 되던 것이 64비트 머신으로 갔더니

cast from pointer to integer of different size

이런 메세지가 뜬다..

 

unsigned short int* 형을 unsigned int형으로 바꾸는 부분에서 발생한 warning인데

sizeof로 확인해보니

unsigned short int*가 64비트에서는 8byte 자료형이고, unsigned int는 4byte 자료형이라서 발생하는 문제였다.

그래서 unsigned int를 unsigned long int로 수정했더니 warning이 사라졌다.