portability of "designated initializers"

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема portability of "designated initializers"
Дата
Msg-id 20081122231029.GF3813@alvh.no-ip.org
обсуждение исходный текст
Ответы Re: portability of "designated initializers"  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi,

I wonder how portable designated initializers are.  As far as I can tell
they were only defined in C99.  Can we use them in our source?  If not,
is there a way to do this in C89?

I mean something like this:

typedef struct foo {       char    type;       union {               int     ival;               float   fval;       }
val;
} foo;

static foo foos[2] = {       {                      .type = 'i',               .val.ival = 42       } , {
  .type = 'f',               .val.fval = 2.78       }
 
};


-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Minor race-condition problem during database startup
Следующее
От: David Fetter
Дата:
Сообщение: Re: Cool hack with recursive queries