Image

Imagedon_oles wrote in Imagecpp

Strange C

I need help with some piece of C code. I am trying to compile it with gcc 2.95.4, and it complains, and I see for the first time such things and don't know how to repair it. The code in questions has to compile on some Linux flavours, but I do it on FreeBSD.

typedef struct
{
    int echo;
    int verbose;
    int result_code_format;
    int pulse_dial;
    int double_escape;
    uint8_t s_regs[100];
} t31_profile_t;

t31_profile_t profiles[3] =
{
    {
        .echo = TRUE,
        .verbose = TRUE,
        .result_code_format = ASCII_RESULT_CODES,
        .pulse_dial = FALSE,
        .double_escape = FALSE,
        .s_regs[0] = 0,
        .s_regs[3] = 10,
        .s_regs[4] = 13,
        .s_regs[5] = '\b',
        .s_regs[6] = 1,
        .s_regs[7] = 60,
        .s_regs[8] = 5,
        .s_regs[10] = 0
    }
};

It complains:

t31.c:60: unknown field `s_regs' specified in initializer
t31.c:61: unknown field `s_regs' specified in initializer
t31.c:62: unknown field `s_regs' specified in initializer
t31.c:63: unknown field `s_regs' specified in initializer
t31.c:64: unknown field `s_regs' specified in initializer
t31.c:65: unknown field `s_regs' specified in initializer
t31.c:66: unknown field `s_regs' specified in initializer
*** Error code 1

How can I persuade compiler to do its job?