[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: About %destructor is c++ mode
From: |
Min Wang |
Subject: |
Re: About %destructor is c++ mode |
Date: |
Thu, 18 Aug 2016 15:07:45 -0400 |
Hi
@Hans, thanks a lot!
Could you explain more on "reference count" ? do you mean std::shared_ptr?
min
On Thu, Aug 18, 2016 at 12:21 PM, Hans Åberg <address@hidden> wrote:
>
> > On 18 Aug 2016, at 18:07, Min Wang <address@hidden> wrote:
>
> > (1) when ListExp was returned up to PROG (e.g: PROG($1)), does it use
> copy
> > constructor? or
> > use move constructor if it existed?
>
> A part from translation of the $-variables, the action code is copied
> verbatim to the C++ parser. So do not think move constructors are invoked,
> since that happens in special syntactic context where it is known that a
> variable will perish.
>
> > (2) should I use object ( ListExp) inside PROG class or a
> > std::unique_ptr inside the PROG to save some copy ? In the latter case,
> > how can I initial std::unique_ptr if the passed parameters if a obj?
>
> Don’t use that, because in some cases there may be an implicit $$ = $1,
> which might make it obsolete. Instead use a reference count or a GC, like
> the Hans Boehm one:
> http://www.hboehm.info/gc/
>
>
>
--
http://www.comrite.com
- About %destructor is c++ mode, Min Wang, 2016/08/18
- Re: About %destructor is c++ mode, Hans Åberg, 2016/08/18
- Re: About %destructor is c++ mode, Min Wang, 2016/08/18
- Re: About %destructor is c++ mode, Hans Åberg, 2016/08/18
- Re: About %destructor is c++ mode, Min Wang, 2016/08/18
- Re: About %destructor is c++ mode, Hans Åberg, 2016/08/18
- Re: About %destructor is c++ mode, Min Wang, 2016/08/18
- Re: About %destructor is c++ mode, Hans Åberg, 2016/08/18
- Re: About %destructor is c++ mode, Min Wang, 2016/08/18
- Re: About %destructor is c++ mode, Hans Åberg, 2016/08/18
- Re: About %destructor is c++ mode,
Min Wang <=
- Re: About %destructor is c++ mode, Min Wang, 2016/08/18
- Re: About %destructor is c++ mode, Hans Åberg, 2016/08/18
- Re: About %destructor is c++ mode, Min Wang, 2016/08/18
- Re: About %destructor is c++ mode, Hans Åberg, 2016/08/19
- Re: About %destructor is c++ mode, Min Wang, 2016/08/19
- Re: About %destructor is c++ mode, Hans Åberg, 2016/08/19
- Re: About %destructor is c++ mode, Min Wang, 2016/08/19
- Re: About %destructor is c++ mode, Hans Åberg, 2016/08/19
- Re: About %destructor is c++ mode, Hans Åberg, 2016/08/19
- Re: About %destructor is c++ mode, Min Wang, 2016/08/19