union, structure, tableau et initialisation
Bonjour à tous,
je suis confronté à un problème d'initialisation, mais je n'arrive pas à trouvé la solution sur le net, voici mon problème :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
typedef enum
{
ENUM_0 = 0,
ENUM_1,
ENUM_2
} enumList;
typedef struct
{
enumList eList;
} structEnumList;
typedef struct
{
uint16_t u16Val1;
uint16_t u16Val2;
} structValues;
typedef union
{
structEnumList stEnumList ;
structValues stValues ;
} unionList;
unionList uList[3]=
{
{{ ENUM_0 }},
{{ 17U, 19U }},
{{ 170U, 190U }}
}; |
Le compilateur me retourne les warnings suivants :
Code:
1 2 3 4 5 6 7 8 9
|
warning: excess elements in struct initializer
{{ 17U, 19U }},
^
warning: (near initialization for 'unionList[1].stEnumList ')
warning: excess elements in struct initializer
{{ 170U, 190U }} };
^
warning: (near initialization for 'unionList[2].stEnumList ') |
En fait il reste bloqué sur le premier élément de mon union sans vérifier le deuxième.
Comment dois-je faire pour écrire mon tableau uList[3] ?
Merci