Re: [Tinycc-devel] about patch: support c99 for-loop init decls

2011-03-08 Thread Joe Soroka
On Tue, Mar 8, 2011 at 1:24 PM, grischka  wrote:
>>> I'd rather let decl0() just do the c99 case and return a value
>>
>> Yes... I wanted to do that, but it didn't seem to fit with the rest of the
>> code.  I thought this way was more tcc-like.
>
> tcc-like in how?  Any evidence of analogous hacks elsewhere in the code?

I just meant leaving decl() alone and creating a decl0() so the other
callsites wouldn't have to change, and I do see evidence of that sort
of thing elsewhere in tcc.  But that's not what you were getting at,
and now I understand.

>> Please feel free to change it however you see fit.
> Maybe I will.

I didn't want to seem ornery, I just meant that I thought I understood
what you were getting at, but that I had absolutely no problem with
someone else committing over top of me, and certainly you would do a
better job than me of expressing your internal concept in code.  Plus
you obviously have more ownership than just about anyone else, so I
was merely deferring to your eminence.

> Until then feel free to fix incorrect variable scope ;)
> [example code]

Darn.  Thank you.  I'm doubly embarrassed now.

Joe

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] about patch: support c99 for-loop init decls

2011-03-08 Thread grischka

Joe Soroka wrote:

On Tue, Mar 8, 2011 at 6:00 AM, grischka  wrote:

I'd rather let decl0() just do the c99 case and return a value


Yes... I wanted to do that, but it didn't seem to fit with the rest of the
code.  I thought this way was more tcc-like.  


tcc-like in how?  Any evidence of analogous hacks elsewhere in the code?


Please feel free to change it however you see fit.


Maybe I will.  Until then feel free to fix incorrect variable scope ;)

int i = -1;
for (int i = 0; i < 4; ++i)
printf("i = %d\n", i);
printf("i = %d\n", i);

--- grischka

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] about patch: support c99 for-loop init decls

2011-03-08 Thread Joe Soroka
On Tue, Mar 8, 2011 at 9:15 AM, Joe Soroka  wrote:
> On Tue, Mar 8, 2011 at 6:00 AM, grischka  wrote:
>> I'd rather let decl0() just do the c99 case and return a value
>
> Yes... I wanted to do that, but it didn't seem to fit with the rest of the
> code.  I thought this way was more tcc-like.  Please feel free to
> change it however you see fit.

I'm sorry, I didn't understand you precisely at first.  I've figured
it out now.  I'll make the changes you've suggested.

Thanks.
Joe

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] about patch: support c99 for-loop init decls

2011-03-08 Thread Joe Soroka
On Tue, Mar 8, 2011 at 6:00 AM, grischka  wrote:
> I'd rather let decl0() just do the c99 case and return a value

Yes... I wanted to do that, but it didn't seem to fit with the rest of the
code.  I thought this way was more tcc-like.  Please feel free to
change it however you see fit.

Thanks.
Joe

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/tinycc-devel


[Tinycc-devel] about patch: support c99 for-loop init decls

2011-03-08 Thread grischka

This patch:
http://repo.or.cz/w/tinycc.git/commitdiff/e23194a1fa2ca176c9151964a2e035f36736e650

moves code that belongs to block()
  -gexpr();
  -vpop();
into decl0()
  +gexpr();
  +vpop();

which is structurally un-nice.

I'd rather let decl0() just do the c99 case and return a value, and then
use like this in block():

 if (tok != ';') {
   if (!decl0(VT_LOCAL, 1)) { /* c99 loop variable */
 gexpr();
 vpop();
   }
 }

Also no need to wrap into a function for only one use, IMO.

Thanks,

--- grischka


___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/tinycc-devel