Old code not compiling with latest version


hi,

i've downloaded latest version 1.6.3, after using 1.5, , code not compiling.

the relevant section of code in seperate header (.h) file , contains initialisation of structure contains anonymous union

code: [select]

enum sysvar_type { sysvar_none,
sysvar_discrete,
sysvar_decimal,
sysvar_string };

typedef struct {
unsigned char type;
union{
  char c[max_string_size];
  int i;
  float f;
} ;
} varrecord_t;

const varrecord_t sysvardefaults[num_sysvars] = {
{sysvar_decimal, {.i=num_sysvars}},
        {sysvar_decimal, {.i=sysvar_db_version}},
        {sysvar_decimal, {.i=sysvar_hw_version}},
{sysvar_decimal, {.i=sysvar_sw_version}},
{sysvar_string, {.c = "apc emb"}},
{sysvar_decimal, {.i=default_node_id}},
{sysvar_string, {.c= "12:34:56:78:9a:bc"}},
{sysvar_string, {.c= "192.168.1.110"}},
{sysvar_string, {.c= "255.255.255.0"}},
{sysvar_string, {.c= "192.168.1.1"}},
                                                {sysvar_decimal, {.i=3456}},
                                                {sysvar_decimal, {.i=0}}
                                              };



the compiler gives following error (5 times);
"... error: c99 designator 'c' outside aggregate initializer"

i've checked on gcc reference, , should work if compiler using c11 (default unless otherwise specified). i've tried using several different styles such previous method using colons

{ c:"192.168.1.1"}

but can't seem work. must reiterate existing code has been compiling ok untill when upgraded latest 1.6.x

can tell me has changed, , have make compiler happy?

thanks in advance

this known (in circles) "improvement"

just use older version.
it easy have both versions on pc.

...r


Arduino Forum > Using Arduino > Programming Questions > Old code not compiling with latest version


arduino

Comments