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.

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to