Article View: aus.computers.linux
Article #54920Help !! Byte alignmnet in gcc
From: Chia-shyan Chou
Date: Thu, 14 Aug 1997 00:00
Date: Thu, 14 Aug 1997 00:00
18 lines
901 bytes
901 bytes
I had write a structure as the following under linux: unsigned short No1; // 2 byte unsigned char No2; //1 byte unsigned char No3; //1 byte unsigned char No4; //1 byte unsigned char No5; //1 byte unsigned char No6; //1 byte unsigned short No7; //2 byte The length of this structure should be 9 bytes, however, the sizeof function return 10. How can I avoid this problem ? Does gcc compiler provide the conditional switch to do byte alignment ? Thankx for your help !!
Technical Details
Message-ID:
<5suenk$69a@news.csie.nctu.edu.tw>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 102983,3d71c8d00623a26e,start X-Google-Attributes: gid102983,public From: cschou@csie.nctu.edu.tw (Chia-shyan Chou) Subject: Help !! Byte alignmnet in gcc Date: 1997/08/14 Message-ID: <5suenk$69a@news.csie.nctu.edu.tw> X-Deja-AN: 264788833 Organization: Dept. Comp. Sci. & Info. Eng., Chiao-Tung Univ., Taiwan Newsgroups: aus.computers.linux