Author: Gian-Carlo Pascutto
Date: 14:10:40 06/26/00
Hi all,
I'm wondering whether the following code is legal ANSI C:
typedef struct {
int from;
int target;
int captured;
int cap_num;
union
{
unsigned int castled:4, was_promoted:1, ep:1, promoted:4;
unsigned int xx;
};
} move_s;
The idea is to do
xx = 0;
when I am sure that it is a normal move, rather than to have to set
each field individually.
MSVC++ has no trouble with this code, but the GNU C Compiler barfs
on it.
I suppose one way to fix this would be to name the union, but that
would require all code which uses the castled, was_promoted, ...
fields to be rewritten...not a nice prospect.
--
GCP
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.