[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: RFC: api.value.automove
From: |
Frank Heckenbach |
Subject: |
Re: RFC: api.value.automove |
Date: |
Fri, 21 Sep 2018 19:54:00 +0200 |
Akim Demaille wrote:
> > For std::unique_ptr, OTOH, it's
> > guaranteed that it leaves it as nullptr. Can you use this in the
> > tests?
>
> I was looking for a test that works with legacy and modern C++.
> (But not expecting the same traces, of course. Just the same
> outcome).
Implementing your own C++11-movable and otherwise copyable type
might be the only way then. (It could be very simple, of course,
like an int that's set to 0 when "moved".)
> Yes, exactly. It's like when a C++98 project is compiled with
> a C++11 compiler: your program is faster 'for free', thanks to
> plenty of implicit moves and a library that is ready to embrace
> them (e.g., all the operations on vectors).
Indeed, the same would be true with Bison's internal moves at least.
> That's why I was aiming first at not requiring modern C++ when
> using automove: this way a project that does not require C++11
> can still compile in C++98, yet benefit from the move-speedup
> if it turns out that the underlying compiler supports it.
>
> Hum. It seems that I'm convincing myself that I should accept
> legacy C++ with automove :/. The question would then be: is
> there a catch I did not see?
Testing perhaps? Like if you enable automove, but keep testing with
C++98 mostly and thus do not notice a bug caused by moving too much.
But I'm not sure if a move-related bug is likely when Bison checks
double-use. So perhaps no problem indeed.
Regards,
Frank
- RFC: api.value.automove, Akim Demaille, 2018/09/19
- Re: RFC: api.value.automove, Hans Ã…berg, 2018/09/19
- Re: RFC: api.value.automove, Frank Heckenbach, 2018/09/20
- Re: RFC: api.value.automove, Akim Demaille, 2018/09/21
- Re: RFC: api.value.automove,
Frank Heckenbach <=
- [PATCH 0/5] lalr1.cc: automove, Akim Demaille, 2018/09/22
- [PATCH 1/5] tests: prepare a test for automove, Akim Demaille, 2018/09/22
- [PATCH 2/5] tests: c++: use a custom string type, Akim Demaille, 2018/09/22
- [PATCH 3/5] c++: introduce api.value.automove, Akim Demaille, 2018/09/22
- [PATCH 4/5] c++: issue a warning with a value is moved several times, Akim Demaille, 2018/09/22
- [PATCH 5/5] news: c++: move semantics, Akim Demaille, 2018/09/22