This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++ edge_iterator (was: Re: [SH] PR 53976 - Add RTL pass to eliminate clrt, sett insns)


On Mon, 2013-12-16 at 11:15 -0500, Trevor Saunders wrote:

> > That could also be an option.  Although having pointer wrappers already
> > in place might open some other opportunities in the future.  For
> > instance it would make it relatively easy to try out reducing the number
> > of garbage collected objects by adding smart pointer functionality to
> > the pointer wrapper.
> 
> Well, I'd expect freeing stuff owned by basic_block should happen in
> basic_block::~basic_block not some pointer wrapper which would be more
> error prone.  However making that happen is kind of tricky while
> basic_block is in gc memory, I've been idly considering allowing gentype
> to call dtors somehow...

Usually smart pointers (i.e. pointer wrappers) don't delete aggregated
stuff in the pointee, but delete the pointee only (if at all).  The
pointee's destructor is then supposed to free whatever it needs to,
which would meet your expectations.

> > 
> > > for (edge *e = vec.begin (); e != vec.end (); e++)
> 
> sure, I think writing that for a vector makes sense, though I might
> manually pull the vec.end() out of the loop

With which intention?

Cheers,
Oleg


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]