Related articles |
---|
Re: YACC error handling heirich@cs.ucsd.edu (1989-07-29) |
yacc error handling ajayk@microsoft.com (Ajay Kalhan) (1999-11-19) |
Re: yacc error handling ajayk@microsoft.com (Ajay Kalhan) (1999-11-21) |
Re: yacc error handling ewbank@lucent.com (Bryan Ewbank) (1999-11-23) |
Re: yacc error handling zalman@netcom11.netcom.com (Zalman Stern) (1999-11-28) |
Re: yacc error handling mschweis@u.arizona.edu (Michael C Schweisguth) (1999-12-07) |
Re: yacc error handling wfahle@bigfoot.com (Bill Fahle) (1999-12-24) |
From: | "Bill Fahle" <wfahle@bigfoot.com> |
Newsgroups: | comp.compilers |
Date: | 24 Dec 1999 00:31:42 -0500 |
Organization: | Compilers Central |
References: | 99-11-117 99-11-128 |
Keywords: | yacc, errors |
Ajay Kalhan <ajayk@microsoft.com> wrote
> (I can see I am extending the original question here)
> What if besides memory I wanted to invoke destructors of created objects?
What I would do is keep a list of allocated objects, all of which
descend from a common base class (make the list a list of that base
class). Give that base class a virtual destructor, and then just call
delete on each object in the list when finished. Of course this
assumes that no object frees another object, since they will be freed
later in the list (or might have already been freed earlier). You
might also look into garbage collection (e.g., reference counting w/
smart pointers) as a way to manage memory.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.