>>> "Wolfgang" == Wolfgang Spraul <[EMAIL PROTECTED]> writes:
> Let's say you have an action that gets an object passed in which
> has a destructor. When using YYABORT inside the action, the
> destructor for this object is always called. When using YYERROR, it
> is never called, i.e. the action needs to destruct passed objects
> itself before using YYERROR. That's because the YYERROR will always
> do a yyvsp-=yylen (and yyssp-=yylen), and thus remove those items
> from the stack before cleanup, whereas YYABORT will not do that.
I have seen a program that started to experience crashes because of
this, but with YYACCEPT! The fix is somewhat not beautiful, basically
something like:
foo: bar { result = $1; $1 = 0; YYACCEPT; };
This was completely unexpected, but like you, I prefer to have a
consistent documented behavior. Maybe we should hold 2.2 until this
is completely settled down, and the documentation make %destructor
official.
I'm not sure about %param-destructor, it is not very clean, but just
like there is %initial-action, we could introduce a %final-action
always run when leaving yyparse (whether on failure or not).
_______________________________________________
[email protected] http://lists.gnu.org/mailman/listinfo/help-bison