Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Unnamed structs in C--bad?

Author: Dave Gomboc

Date: 15:58:41 12/02/99

Go up one level in this thread


On December 02, 1999 at 16:21:48, Tom Kerrigan wrote:

>I'm currently using the following to define a move:
>
>typedef union {
>  int i;
>  struct {
>    char from;
>    char to;
>    char promote;
>    char flags;
>  };
>} move_t;
>
>This allows the structure to be treated as an integer, so moves can be copied
>and compared easily.
>
>However, I just noticed that VC++ 5.0 produces a level 4 warning because the
>struct is unnamed.
>
>How bad is this? Will some compilers not compile my stuff because of it?
>
>-Tom

Not sure if unnamed structs are legit in C or not.

I don't remember exactly, but I think that I tried ditching the int i and using
an int for each member of the struct, and that doing this gave a speedup over
the original code.

Dave



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.