[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] Compound Literals
From: |
Andrew Johnson |
Subject: |
Re: [Tinycc-devel] Compound Literals |
Date: |
Tue, 26 Sep 2006 12:48:13 -0400 (EDT) |
Ah. Yes. You are correct. I did check, and inside functions, its working fine.
So this is effectively a bug with compound literals, but only in the global
scope....
Which is naturally where I use them the most, of course. ;)
I will look at tcc code. It's probably beyond my ability to fix. But never
hurts to try.
Andrew
>From: Dave Dodge <address@hidden>
>Sent: Sep 26, 2006 9:22 AM
>To: Andrew Johnson <address@hidden>, address@hidden
>Subject: Re: [Tinycc-devel] Compound Literals
>
>On Tue, Sep 26, 2006 at 12:33:28AM -0400, Andrew Johnson wrote:
>> struct point { int X; int Y; } *test = &((struct point){1, 1});
>>
>> Is this a bug in compound literals support, or does tcc currently
>> not support them at all?
>
>I'm guessing you're defining them outside a function. It seems to
>have a problem with that. It does appear to support them within
>functions, with or without designated initializers. For example:
>
> extern void foo(struct point *);
>
> void bar(void)
> {
> struct point * pp = &((struct point){1,1});
> foo(pp);
> foo(&((struct point){1,1}));
> foo(&((struct point){.X=1,.Y=1}));
> }
>