[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: %destructor feedback
From: |
Joel E. Denny |
Subject: |
Re: %destructor feedback |
Date: |
Tue, 3 Jan 2006 01:17:48 -0500 (EST) |
On Tue, 27 Dec 2005, Akim Demaille wrote:
> Le 22 d?c. 05 ? 19:49, Joel E. Denny a ?crit :
>
> > Would it be worthwhile to warn about unmentioned typed $$ as well?
[snip]
> I installed the following. Note that the warning is somewhat annoying
> with rules running YYERROR etc.
After seeing your test case patch, I seriously reconsidered whether $$
warnings were reasonable. However, the function analogy for semantic
actions helped me think this through. Typed RHS symbols are like
parameters. As we well know, a good compiler or lint implementation will
warn you if you forget to use one. Typed LHS symbols are like non-void
return types. A good compiler will also warn you if you forget to return
something. However, I've not seen a compiler that suppresses this warning
just because you invoke abort() somewhere.
The following seems misleading to me because it seems to imply that the 0
actually has some significance even though the parser discards $$. You
did something similar in your test case patch:
{
$$ = 0;
YYABORT;
}
This seems clearer:
{
YYABORT;
$$ = 0;
}
similar to:
int function() {
abort();
return 0;
}
This seems even clearer:
{
YYABORT;
YYUSE_VAL ($$);
}
What do you think?
Joel