Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: c programming q

Author: Robert Hyatt

Date: 07:27:43 05/09/03

Go up one level in this thread


On May 09, 2003 at 01:06:21, Leen Ammeraal wrote:

>On May 08, 2003 at 21:00:46, Zach Wegner wrote:
>
>>In my program, I have the move data structure:
>>typedef struct
>>{
>>    union
>>    {
>>        struct
>>        {
>>            char from;
>>            char to;
>>            char bits;
>>            char piece;
>>        };
>>        unsigned int move;
>>    };
>>    unsigned int score;
>>} SMOVE;
>>
>>Is there any specific order in which the chars are aligned into the int, or is
>>it compiler-dependent?
>>
>>Zach
>
>It is compiler dependent.
>Leen


It can't be.  Only bit-fields are left to the compiler to decide which end to
start from.  If the above was compiler dependent it would be _impossible_ to
read in data files produced by another compiler on the same machine...



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.