| [ CnUnix ] in KIDS 글 쓴 이(By): parsec ( 먼 소 류 ) 날 짜 (Date): 2002년 3월 21일 목요일 오전 01시 17분 35초 제 목(Title): Re: [Q] sizeof 문제... 언제나 뒷북... ARM 프로그램에서 typedef struct st1 { unsigned short a : 4; unsigned short b : 7; unsigned short c : 5; } type1; typedef union un1 { unsigned short g; type1 x; } type2; 이렇게 하고 나서, extern unsigned short arry[]; type2 *tbuf = (type2 *)(&arry[0]); 이렇게 하면 tbuf[i] 를 접근할 때 arry[2*i] 값이 access 됩니다. armcc 와 tcc(thumb cc)로 테스트를 해봐도 sizeof(type1), sizeof(type2) 모두 2가 나오는데 말이죠. 별 수 없이 type2 tbuf; tbuf.g = arry[i] 로 접근한 다음 tbuf.x.a ... 이런 식으로 사용하고는 있지만요... ◇ ~~~_ _ ∴ ~|~| | _/__, SEP. 11. 2001 _ ∴∴ _ ~ | | \ ` Armorica under a tat ,-| `,-,_| |__ | | | A ______|_|__|_|___|__|| | |__|_|_____________________________________ |