[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: About %destructor is c++ mode
From: |
Hans Åberg |
Subject: |
Re: About %destructor is c++ mode |
Date: |
Thu, 18 Aug 2016 18:21:50 +0200 |
> 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/
- 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 <=
- Re: About %destructor is c++ mode, Min Wang, 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/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