bug-bison
[Top][All Lists]
Advanced

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

Re: Bison GLR buffer-overflow and invalid pointer fixes


From: Paul Eggert
Subject: Re: Bison GLR buffer-overflow and invalid pointer fixes
Date: Thu, 07 Jul 2005 22:05:19 -0700
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

address@hidden writes:

> All around in glr.c are lines with multiple vars on one line.
> It can be considered to use one var on one line because (from
> experience) some compiler warnings possibly are not detected
> when multiple vars are on one single line. Its compiler issue.

I haven't run into this problem.  Is it a serious one?  If not,
let's leave things alone.  The GNU coding standards allow you
to say things like "int foo, bar;".

> For example: ...
> static int
> yypreference (yySemanticOption* y0, yySemanticOption* y1)
> {
>   yyRuleNum r0 = y0->yyrule, r1 = y1->yyrule;
>   int p0 = yydprec[r0], p1 = yydprec[r1];
>
> To be changed into: ...
> static int
> yypreference (yySemanticOption* y0, yySemanticOption* y1)
> {
>   yyRuleNum r0 = y0->yyrule;  <--------
>   yyRuleNum r1 = y1->yyrule;  <--------
>   int p0 = yydprec[r0];       <--------
>   int p1 = yydprec[r1];       <--------
>
> Adding the missing '{' '}' possibly improves compiler optimizing.

I don't understand the last comment.  There aren't any missing braces
here.  And I wouldn't expect the revised version to be easier for a
compiler to optimize.

I do prefer the second form myself -- it's easier for me to see the
parallel forms in the code, and to catch coding errors -- but this is
mainly a style issue, and a minor one at that, and I'd rather defer to
Paul Hilfinger's stylistic sense here.




reply via email to

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