Bison, C++ and shared_ptr<>

"Paulo Matos" <pocmatos@gmail.com>
3 Feb 2006 18:39:05 -0500

          From comp.compilers

Related articles
Bison, C++ and shared_ptr<> pocmatos@gmail.com (Paulo Matos) (2006-02-03)
Re: Bison, C++ and shared_ptr<> cbarron3@ix.netcom.com (2006-02-03)
Re: Bison, C++ and shared_ptr<> haberg@math.su.se (2006-02-06)
| List of all articles for this month |

From: "Paulo Matos" <pocmatos@gmail.com>
Newsgroups: comp.compilers,comp.unix.programmer
Date: 3 Feb 2006 18:39:05 -0500
Organization: http://groups.google.com
Keywords: yacc, C++, storage, question
Posted-Date: 03 Feb 2006 18:39:05 EST

Hi all,


Lately I've been dealing with some wierd memory leaks reported by
valgrind on my bison generated parser. One of the things I had
difficulty with when I designed the parser is that I cannot have types
with constructors on the %union. Which is definitely a pity... One of
the things it would be great to have there would be a pair<int, int>,
which is impossible so I have a pair<int,int>* but that makes me
allocate and deallocate several times with the possibility of memory
leak (like the one that's happening). I've been reading about
shared_ptr<> which would be great on the case but it seems %union won't
let me have a shared_ptr<> as a member. shared_ptr<>* seems awkward and
meaningless so what I would really like to know is if there is any
trick to make bison work nicely with 'types with constructors' or
shared_ptr<>. :)


Thanks,


Paulo Matos


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.