[antlr-interest] TokenStreamRewriteEngine and C++ and RefCounters
Andrey R. Urazov
a_urazov at mail.ru
Wed Apr 28 09:02:58 PDT 2004
On Wed, Apr 28, 2004 at 12:50:56PM +0200, Ric Klaren wrote:
> > (in Boost, for example, these aren't defined at all). When
> > implemented together, not only they are unsafe, they are rather
> > dangerous since they can lead to nonshared ownership of a single
> > object and therefore to its premature deletion.
>
> I personally did not run into premature deletion problems (using a malloc
> debugger very regularly to verify my project) There might be a resource
> leak though but I'm not sure wether that's due to antlr or my own code.
>
I was wrong. Sorry. I've just written a small program to test the
problem I thought took place and what I've found is that addChild() is
absolutely clean in conjuction with current implementation of smart
pointers in the sense I erroneously blamed it.
> > Consider the code from BaseAST.cpp (the problems I experience now are
> > caused by the implicit misuse of smart pointers in this function):
>
> I'll have a look at this when I'm not two days behind on sleep... (probably
> a lot safer ;) )
It seems to be clean and therefore should not prevent you from sleeping.
;) There was no bug in the ANTLR code, just a small bug in my head :)
probably because of lack of sleep and most certainly because of
a strange tendency to find errors in others' code rather than in my own
;)
> Shouldn't there be a '!' on this rule to turn of automatic
> treeconstruction? (unless you have it turned off on grammar level)
> This might create a loop in the tree which might hang up
> getNumberOfChildren if I'm not mistaken.
You are a clairvoyant! Exactly! This is what actually happened. Thanks
a lot for helping me out.
Best regards,
Andrey Urazov
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/antlr-interest/
<*> To unsubscribe from this group, send an email to:
antlr-interest-unsubscribe at yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list