Page 1 of 1

aggregate initializer

Posted: Fri Jan 09, 2004 6:09 am
by Adek336
"keycodes.hpp:266: warning: aggregate has a partly bracketed initializer"

it's only a warning, but I prefer to have my code clean :o I've got my scan code table:

Code: Select all

struct
 {
  char make_cd, break_cd, letter;
 } keyTable[_KTABLE_SIZE] =
    {
      MAKE_ESC, BREAK_ESC, 27,
      MAKE_1,   BREAK_1,   '1',
      MAKE_2,   BREAK_2,   '2',
      MAKE_3,   BREAK_3,   '3',
...
      MAKE_SPACE,BREAK_SPACE,' ',
      MAKE_F1,BREAK_F1,0
};
Does anybody understand the warning by any chance?

Cheers,
Adrian

Re:aggregate initializer

Posted: Fri Jan 09, 2004 7:20 am
by pini
You should place each group of data into brackets, like this :

Code: Select all

struct
 {
  char make_cd, break_cd, letter;
 } keyTable[_KTABLE_SIZE] =
    {
     { MAKE_ESC, BREAK_ESC, 27 },
     { MAKE_1,   BREAK_1,   '1' },
     { MAKE_2,   BREAK_2,   '2' },
     { MAKE_3,   BREAK_3,   '3' },
...
     { MAKE_SPACE,BREAK_SPACE,' ' },
     { MAKE_F1,BREAK_F1,0}
};

Re:aggregate initializer

Posted: Fri Jan 09, 2004 1:53 pm
by Adek336
Thank you! Now it works ;D