Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: another simple c question

Author: Robert Hyatt

Date: 08:21:36 07/21/04

Go up one level in this thread


On July 21, 2004 at 06:16:10, Daniel Shawul wrote:

>
>Isn't the size of a struct the sum of the sizes of its members.
>
>but for this struct sizeof(HASH_E) gives me 16 when i expect 14
>
>struct HASH_E
>{
>	HASHKEY checksum;
>	char     from;
>	char     to;
>	short    eval;
>	unsigned char    depth;
>	unsigned char    entry_threat_promote_seq;
>};
>
>daniel


No.  Structs get padded to some size.  IE on X86 they get padded to the nearest
4-byte size rounded up.  On the opteron, in 64 bit mode, they get rounded to the
nearest 8 byte size rounded up.



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.