This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.
See the CrossGCC FAQ for lots more information.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
>-----Original Message----- >From: Cliff Tsai [mailto:clifftsai@minecard.com.tw] >Sent: 24 May 2001 11:42 > I have a simple struct as follow > > struct test_align > { > unsigned char Name[21]; > unsigned char Version[8]; > }; > > But on cygwin for x86,the sizeof(struct test_align) is 29; > > but on cygwin for arm,the sizeof(struct test_align) return 32 > > WHY. I guess it's getting aligned. x86 is happy to read any datatype from any alignment address but I believe ARM likes things to be long word aligned, so it puts three padding bytes after Name[] so that the first byte of Version[] is aligned to a multiple of 4 bytes. I don't think it should really need to do this for chars, but I don't know ARM very well so I can't explain the motivation. However, the simplest way to fix it will be by using either the 'packed' or 'aligned' attributes - look them up in the gcc manual/info pages. DaveK -- *** RIP: Douglas Adams. So long, and thanks for all the books. *** ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com ********************************************************************** ------ Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |