реклама на сайте
подробности

 
 
> Инициализация члена структуры А, типа структуры В ?, В чем проблема?
alux
сообщение Apr 25 2007, 11:46
Сообщение #1


Знающий
****

Группа: Свой
Сообщений: 589
Регистрация: 24-04-05
Пользователь №: 4 447



Компилятор выдает ошибку:
Error[Pe1049]: initializer cannot be specified for a flexible array member .

Использую IAR v.4.12A .

typedef struct menu_entry_s {
unsigned char flags; // see flag definitions above
void (*select)(void *arg, char *name); // routine to call when selected
char name[MENU_ENTRY_NAMELEN]; // name to display for this entry
void *value; // value to pass to select function
} menu_entry_t;

/* Information on a specific menu. Previous is for the menu
that this is a submenu of, or NULL if this is the main menu */

typedef struct menu_s {
unsigned char top_entry; // top displayed entry
unsigned char current_entry; // currently highlighted entry
unsigned char num_entries; // total # of entries in menu
struct menu_s *previous; // previous menu (for backtracking)
menu_entry_t entry[];
} menu_t;
................................................................................
...........................

menu_t sub1_menu = {
.top_entry = 0,
.current_entry = 0,
> .entry = { //!!!!!Error[Pe1049]: initializer cannot be specified for a flexible array member .
{.flags = 0,
.select = my_select,
.name = "s2",
.value = 0,
},
{.flags = 0,
.select = my_select,
.name = "s3",
.value = 0,
},
{.flags = 0,
.select = my_select,
.name = "s4",
.value = 0,
},
},
.num_entries = 3,
.previous = NULL,
};

Что я делаю не так?
Go to the top of the page
 
+Quote Post



Reply to this topicStart new topic
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0

 


RSS Текстовая версия Сейчас: 20th July 2025 - 19:04
Рейтинг@Mail.ru


Страница сгенерированна за 0.01347 секунд с 7
ELECTRONIX ©2004-2016