[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 16:36:33 -0400 |
HI
Another dummy question:
How to I express
exp: Exp1 "OR" Exp
| Exp1
in class if I do not use pointer? I mean class Exp is just a pure
interface class?
class Exp {
}
class Elor : public Exp
{
public:
Exp exp_1; // if not a pointer?
Exp exp_2; // if not a pointer
~Elor() {}
}
Thanks.
min
On Thu, Aug 18, 2016 at 3:07 PM, Min Wang <address@hidden> wrote:
> 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
>
>
>
>
--
http://www.comrite.com
- Re: About %destructor is c++ mode, (continued)
- 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, 2016/08/18
- Re: About %destructor is c++ mode,
Min Wang <=
- 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
- Re: About %destructor is c++ mode, Hans Åberg, 2016/08/19