[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: |
Fri, 19 Aug 2016 09:45:08 -0400 |
HI
@Hans. thanks
so if every rule has an explicit action, the issue could be avoided, right?
min
On Fri, Aug 19, 2016 at 4:15 AM, Hans Åberg <address@hidden> wrote:
>
> > On 19 Aug 2016, at 05:50, Min Wang <address@hidden> wrote:
>
> > on another thread at:
> > http://lists.gnu.org/archive/html/bug-bison/2016-08/msg00006.html
>
> I am on that list, too.
>
> > it seems I could use std::unique_ptr as the semantic value , but need one
> > hack
> >
> > - return *new (yyas_<T> ()) T (t);
> > + return *new (yyas_<T> ()) T (std::move((T&)t));
>
> The issue is that in the original C parser, the implicit $$ = $1 that
> occurs when not writing an explicit action is always executed first before
> any other eventual action. In C this is fine, and not so so expensive as
> there are no copy constructors. This implementation was carried over at
> least in the original C++ parser.
>
> When you then use the std::unique_ptr in $1 it will first implicitly move
> over to $$, and if trying to access $1 explicitly in an action, the pointer
> is dead.
>
> So the hack depends on what the C++ implementation currently is, which may
> change.
>
>
>
--
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, 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 <=
- 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
- Re: About %destructor is c++ mode, Min Wang, 2016/08/19
- 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