tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] [BUG] Nested array/struct/union initialization proble


From: Dave Dodge
Subject: Re: [Tinycc-devel] [BUG] Nested array/struct/union initialization problem
Date: Tue, 25 Sep 2007 23:16:29 -0400
User-agent: Mutt/1.5.13 (2006-08-11)

On Tue, Sep 25, 2007 at 06:37:01PM +0200, Marc Andre Tanner wrote:
> The call to expect comes from within unary () at tcc.c:6587 where t = '.'
> 
> struct format_option {
>         union {
>                 const char * fo_str ;
>                 int fo_int ;
>                 int fo_time ;
>         } ;

Bear in mind that Standard C requires a name for this union.  tcc
allows it to be anonymous as an extension, presumably to be compatible
with gcc which itself only allows it in order to be compatible with
other compilers.  gcc does throw a fit if you try to compile that code
with "-std=c99".

It looks like there's some sort of conflict or missing code to get
designated initializers and anonymous unions working together.  If you
take out the designated initializer tcc will accept it, but with the
downside that you can't initialize fo_int or fo_time.  Alternatively,
if you give the union a name tcc will accept it (and the code becomes
proper C), but you'll probably also have to fixup all of the places
that access that union.

                                                  -Dave Dodge




reply via email to

[Prev in Thread] Current Thread [Next in Thread]