Unknown array initialization error

I tried to create an Intel 8080 processor emulator (then I would like to emulate Space Invaders that use it).

I encoded an almost complete implementation of this processor (thanks to MAME and the Tickle project (mostly);)), with the exception of instructions without documents (0x08, 0x10, 0x18, 0x20, 0x28, 0x30, 0x38, 0x0CB, 0x0D9, 0x0DD, 0x0ED, 0x0FD )

I only have problems compiling, I don’t know why.

This is the code:

static const unsigned char cycles_table[256] =
{
    /*                       8080 Cycles Table                         */
    /*     0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F */
    /*0*/  4, 10,  7,  5,  5,  5,  7,  4,  0, 10,  7,  5,  5,  5,  7,  4,
    /*1*/  0, 10,  7,  5,  5,  5,  7,  4,  0, 10,  7,  5,  5,  5,  7,  4,
    /*2*/  0, 10, 16,  5,  5,  5,  7,  4,  0, 10, 16,  5,  5,  5,  7,  4,
    /*3*/  0, 10, 13,  5, 10, 10, 10,  4,  0, 10, 13,  5,  5,  5,  7,  4,
    /*4*/  5,  5,  5,  5,  5,  5,  7,  5,  5,  5,  5,  5,  5,  5,  7,  5,
    /*5*/  5,  5,  5,  5,  5,  5,  7,  5,  5,  5,  5,  5,  5,  5,  7,  5,
    /*6*/  5,  5,  5,  5,  5,  5,  7,  5,  5,  5,  5,  5,  5,  5,  7,  5,
    /*7*/  7,  7,  7,  7,  7,  7,  7,  7,  5,  5,  5,  5,  5,  5,  7,  5,
    /*8*/  4,  4,  4,  4,  4,  4,  7,  4,  4,  4,  4,  4,  4,  4,  7,  4,
    /*9*/  4,  4,  4,  4,  4,  4,  7,  4,  4,  4,  4,  4,  4,  4,  7,  4,
    /*A*/  4,  4,  4,  4,  4,  4,  7,  4,  4,  4,  4,  4,  4,  4,  7,  4,
    /*B*/  4,  4,  4,  4,  4,  4,  7,  4,  4,  4,  4,  4,  4,  4,  7,  4,
    /*C*/  5, 10, 10, 10, 11, 11,  7, 11,  5, 10, 10,  0, 11, 17,  7, 11,
    /*D*/  5, 10, 10, 10, 11, 11,  7, 11,  5,  0, 10, 10, 11,  0,  7, 11,
    /*E*/  5, 10, 10, 18, 11, 11,  7, 11,  5,  5, 10,  4, 11,  0,  7, 11,
    /*F*/  5, 10, 10,  4, 11, 11,  7, 11,  5,  5, 10,  4, 11,  0,  7, 11
};

g ++ accepts this error:

8080.h: 521: error: invalid initialization in a static element of a static element of a non-integer type `const unsigned char [256] '

This array is in class i8080.

+3
source share
3

, . :

static const unsigned value = 123;
static const bool value_again = true;

.

, :

static const unsigned char cycles_table[256];

, :

const unsigned char i8080::cycles_table[256] = // ...

, , ( ): ", ". : ", ".

+13

.

0

, , :

class Thing
{
public:
    static const int [3] = {1, 2, 3};
};

:

thing.h:

class Thing
{
public:
    static const int vals[3];;
};

thing.cpp:

const int Thing::vals[3] = {1, 2, 3};
0

Source: https://habr.com/ru/post/1729980/


All Articles