C++14 is here. Should we use it?

218 views
Skip to first unread message

Nico Weber

unread,
Aug 4, 2017, 2:41:01 PM8/4/17
to cxx
Hi,

(bcc chromium-dev, blink-dev -- join us over at cxx@ if you want to participate in the discussion)

as of last week, I think all our toolchains support C++14.

What's new in C++14? See http://chromium-cpp.appspot.com/#core-review-14 and http://chromium-cpp.appspot.com/#library-review-14 -- thanks to jbroman for helping with documenting this. It's a fairly small language extension, but some things look useful (std::make_unique could replace base::MakeUnique, the extended constexpr support can be handy in some limited circumstances like e.g. base/numerics, etc).

However, the google style guide doesn't make any recommendations about C++14 yet. So we'd have to guess which recommendations google style will make about C++14, and if we guess wrong that'd be somewhat unfortunate.

Do people have an opinion on what to do? Hold off on C++14 stuff completely? Only allow "obviously ok" things (e.g. make_unique, but maybe not generic lambdas and generalized constexpr)? Do our best at guessing and then clean up after the fact when we guess wrong?

Nico

dyar...@yandex-team.ru

unread,
Aug 6, 2017, 8:16:45 PM8/6/17
to Chromium-dev, c...@chromium.org
Hooray for C++14!

Generic lambdas are amazing - let's allow generic lambdas! Using algorithms without horrible typing!

[](const std::unique_ptr<long_namespace::GodKnowsHowLongThisNameIs>& lhs,
   const std::unique_ptr<long_namespace::GodKnowsHowLongThisNameIs>& rhs) {
  return lhs->name < rhs->name
}

Can you please tell, why do we have troubles with modern C++ support?


пятница, 4 августа 2017 г., 21:41:01 UTC+3 пользователь Nico Weber написал:

Jeremy Roman

unread,
Aug 15, 2017, 7:32:53 PM8/15/17
to dyar...@yandex-team.ru, Chromium-dev, cxx
It seems like there's generic support for a number of basic features. I'm going to run through them moderately quickly, starting with the least controversial ones (like std::make_unique).

--
You received this message because you are subscribed to the Google Groups "cxx" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cxx+uns...@chromium.org.
To post to this group, send email to c...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/cxx/2f1151aa-2c31-496c-94e9-819636c867da%40chromium.org.

Jeremy Roman

unread,
Aug 15, 2017, 8:28:18 PM8/15/17
to dyar...@yandex-team.ru, Chromium-dev, cxx
Bulk library approval CLs (separate so that it's easier to isolate/revert individual changes if they cause build failures):

std::integer_sequence: https://chromium-review.googlesource.com/c/616082/

Language features that seemed well-accepted to follow.

Jan Wilken Dörrie

unread,
Aug 16, 2017, 3:35:48 PM8/16/17
to Jeremy Roman, dyar...@yandex-team.ru, Chromium-dev, cxx
This is almost too trivial to ask, but I would also like to see the two ranges overloads for std::mismatch, std::equal and std::is_permutation: http://www.open-std.org/JTC1/sc22/WG21/docs/papers/2013/n3671.html

I'm mostly interested in std::equal, as this allows easy implementation of operator== for custom container types, but the overloads for mismatch and permutation should be added for consistency as well.
Furthermore, the two ranges std::equal is already used in the code base: https://codesearch.chromium.org/chromium/src/base/containers/span.h?l=71

Best,
Jan

Jeremy Roman

unread,
Aug 16, 2017, 3:56:17 PM8/16/17
to Jan Wilken Dörrie, dyar...@yandex-team.ru, Chromium-dev, cxx
On Wed, Aug 16, 2017 at 3:34 PM, Jan Wilken Dörrie <jdoe...@chromium.org> wrote:
This is almost too trivial to ask, but I would also like to see the two ranges overloads for std::mismatch, std::equal and std::is_permutation: http://www.open-std.org/JTC1/sc22/WG21/docs/papers/2013/n3671.html

I'm mostly interested in std::equal, as this allows easy implementation of operator== for custom container types, but the overloads for mismatch and permutation should be added for consistency as well.
Furthermore, the two ranges std::equal is already used in the code base: https://codesearch.chromium.org/chromium/src/base/containers/span.h?l=71

I'm inclined to agree. I'm happy to review a CL listing the overloads in styleguide/ if you think it would help, but in my mind these overloads are sufficiently trivial additions to the language as not separate approval.

bruce...@chromium.org

unread,
Aug 22, 2017, 8:32:15 PM8/22/17
to cxx, jdoe...@chromium.org, dyar...@yandex-team.ru, chromi...@chromium.org
One thing I would caution about is that the compiler situation for Chrome on Windows is still in flux. We switched to clang but hit a few issues so we temporarily returned to VC++. We expect to switch back to clang soon but we would like to retain the option to return to VC++ if needed. Currently that means VC++ 2015, with its C++14 conformance limitations.

We may be able to switch to VC++ 2017 Update 3 soon which will raise our conformance floor - by the end of the year VC++ 2017 plans to have full C++14 compliance and significant C++17 compliance as well (IIRC).
Reply all
Reply to author
Forward
0 new messages