[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Re[2]: bison %union and C++
From: |
Akim Demaille |
Subject: |
Re: Re[2]: bison %union and C++ |
Date: |
30 Sep 2002 10:42:59 +0200 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Honest Recruiter) |
>>>>> "Oleg" == Oleg Smolsky <address@hidden> writes:
Oleg> Hello Akim, Akim Demaille wrote on Wednesday, September 25,
Oleg> 2002: So, is there any way to get bison to store one of my
Oleg> objects on its stack?
AD> Using pointers to string. Or make sure to have a single hierarchy,
AD> which means that you must wrap std::string :(
Oleg> yeah, but every time bison removed something from the stack I
Oleg> get a memory leak. (which I have worked around by keeping track
Oleg> of what bison allocs and frees, but it's quite nasty)
If you are ready to use a beta (and it will certainly change in the
future, so *this is a bad idea*), you can try this:
%destructor { delete $$; } expr stmt etc...
%destructor { free ($$); } C_STRING