Re: Fwd: Re: [AD] [AL] Problems with dat2c

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


onsdagen den 9 oktober 2002 08.33 wrote Christer Sandberg:
> No, on compilers < C99 the warning is because the size of
> initialisation data is > 0. It should be investigated carefully
> on C99-compliant compilers too.
> char s[]="foo";
> This local/global decl assumes eos beeing part of the init data.
> Is it really true that flexible array memers in C99 don't
> conform to this convention? I'll have a look at the C99 spec,
> and also try it out on an gcc > 3 compiler.
> /C
I can't find anything in the C99 that says anything about it, nothing in the 
gcc-docs about differences to C99 accoring this. I also installed gcc 3.2 on 
a box at work and compiled the below code without warnings. 
struct foo {
   int x;
   char y[];
};
static struct foo bar={42,"asdf"};
static struct foo baz={42,"asdfgh"};
Substituting the y[] with y[0] gives the same warnings for gcc2.96 and 3.2, 
the array will however be filled properly in case of 3.2 but not in case of 
2.96. The former is not a result of the C99 compliance in gcc 3.2 but rather 
an extension. Anyway, in Allegro a gcc 3.2 compiler will never see the 'y[0]' 
in the concerned structs due to the "flexible array macro" so there should be 
no problem. Can you post a piece of code that generates the warnings using 
gcc 3.2?
/C



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/