[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: %destructor feedback
From: |
Akim Demaille |
Subject: |
Re: %destructor feedback |
Date: |
Thu, 20 Oct 2005 15:18:56 +0200 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) |
>>> "Wolfgang" == Wolfgang Spraul <address@hidden> 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).
- Re: %destructor feedback, (continued)
- Re: %destructor feedback, Paul Eggert, 2005/10/18
- Re: %destructor feedback, Akim Demaille, 2005/10/20
- Re: %destructor feedback, Joel E. Denny, 2005/10/20
- Re: %destructor feedback, Frank Heckenbach, 2005/10/21
- Re: %destructor feedback, Joel E. Denny, 2005/10/21
- Re: %destructor feedback, Frank Heckenbach, 2005/10/22
- Re: %destructor feedback, Joel E. Denny, 2005/10/22
- Re: %destructor feedback, Frank Heckenbach, 2005/10/22
- Re: %destructor feedback, Joel E. Denny, 2005/10/22
Re: %destructor feedback,
Akim Demaille <=