Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: TSCP / C++ question

Author: Will Singleton

Date: 00:33:29 05/12/99

Go up one level in this thread


On May 12, 1999 at 01:01:00, Dave Gomboc wrote:

>I am taking a quick look at Tom's Simple Chess Program.  Here's a snippet:
>
>/* the initial board state */
>
>int init_color[64] = {
>    1, 1, 1, 1, 1, 1, 1, 1,
>    1, 1, 1, 1, 1, 1, 1, 1,
>    6, 6, 6, 6, 6, 6, 6, 6,
>    6, 6, 6, 6, 6, 6, 6, 6,
>    6, 6, 6, 6, 6, 6, 6, 6,
>    6, 6, 6, 6, 6, 6, 6, 6,
>    0, 0, 0, 0, 0, 0, 0, 0,
>    0, 0, 0, 0, 0, 0, 0, 0
>};
>
>Now, imagine you are trying to do this in OO-style.  Say you have some class
>State, and you want this to be inside of it.
>
>So (in C++):
>
>class State {
>
>public:
>    // stuff
>
>protected:
>    // more stuff
>
>    int init_color[64] = {
>        1, 1, 1, 1, 1, 1, 1, 1,
>        1, 1, 1, 1, 1, 1, 1, 1,
>        6, 6, 6, 6, 6, 6, 6, 6,
>        6, 6, 6, 6, 6, 6, 6, 6,
>        6, 6, 6, 6, 6, 6, 6, 6,
>        6, 6, 6, 6, 6, 6, 6, 6,
>        0, 0, 0, 0, 0, 0, 0, 0,
>        0, 0, 0, 0, 0, 0, 0, 0
>    };
>};
>
>This, however, does not compile.  (MSVC 6.0 reports error C2059, a syntax error
>on the '{'.  Presumably, the array initialization isn't allowed.)
>
>Ideally, this array would be declared static and const as well.
>What is wrong here?  How can it be corrected?
>
>Dave

Got tired of awari? :)

Will



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.