Meeting 5 April 2018
Jacksonville 2018 – C++20
-
Trip reports
-
Previously
-
The Plan (according to Herb Sutter – Thanks Bjarne):
- Executors: TS in the C++20 timeframe, standard in C++23
- Networking: C++23 (delayed by Executors)
- Coroutines: C++20
- Modules: Partially in C++20 with more in C++23 (blame Google)
- Contracts: C++20
- Reflection: TS in C++20 timeframe, standard in C++23
- Ranges: Core in C++20, cool stuff in C++23
April Fools, C++ edition
No, I’m not going to link to that.
STL on Twitter
# MSVC’s STL is 99% C++17 feature complete! In VS 2017 15.7, we’re shipping Filesystem, Parallel Algorithms (all signatures available, many actually parallelized, more later), constexpr char_traits
(for string_view
), Special Math, hypot(x, y, z)
, launder()
, and Deduction Guides.
# 15.7 will contain a partial implementation of Elementary String Conversions in <charconv>
: integers only. The floating-point part is the last STL feature that needs to be implemented. We’re also almost done with LWG issues: 33 added in 15.7, 14 done in future branches, 15 remain.
CLion 2018.1 released
- Better C++17 support
- Support for Clang-tidy configuration files
- Produce Linux binaries on Windows
- Built-in Valgrind memcheck in WSL
- Open single file/folder without CMake
- Breadcrumbs in the editor
- Partial Git commits
- Support for Rust, Fortran, Objective-C/C++
VisualAssistX
C++ auto-generated comparison operators
- Bjarne Stroustrup’s post
- N3950: Defaulted comparison operators, by Oleg Smolsky
- N4175: Default comparisons, by Bjarne Strourtrup
- N4239: Defaulted Comparison Using Reflection
- N4401: Defaulted comparison operator semantics should be uniform
- P0221: Proposed wording for default comparisons, revision 2
- P0515: Consistent comparison (the spaceship operator)
- Reddit: Immutable objects in C++
True parallelism, with no concept of threads - Alfred Bratterud - Meeting C++ 2017
Fibers, green threads, channels, lightweight processes, coroutines, pthreads - there are lots of options for parallelism abstractions. But what do you do if you just want your application to run a specific task on a specific core on your machine? In IncludeOS we have proper multicore support allowing you to do just that in C++: assign a task - for instance a lambda - directly to an available CPU. <…> In this talk we’ll <…> explore how direct per-core processing can be combined with threading concepts like C++14 fibers or coroutines, without taking away from the simplicity of getting work done uninterrupted.
Conclusions:
- You don’t need classical threads to utilize CPU cores
- Fibers and coroutines can run directly on them
- A pthreads backend requires true blocking
- Might require fibers, yielding directly to scheduler
- Coroutines TS beats the simplest stack switch
- Stackful coroutines would replace our fibers
- Expect more multicore magic from IncludeOS
SwedenCpp - Arvid Norberg: Integers in C++
- How undefined signed overflow enables optimizations in GCC
- Guidelines for integers:
- Signed: when you need normal arithmetic
- Unsigned: flags, IDs, enumerations (
enum class
), bits - Avoid viral promotion of unsigned types wider than
int
- Avoid implicit sign conversions:
-Wsign-conversion -Werror
1int32_t a = -1; uint32_t b = 1;
2if (a > b) std::cout << "wat"; // `a` --> 0xffffffff
C++20: Signed Integers are Two’s Complement
Video: Deep Learning with C++ - Peter Goldsborough - Meeting C++ 2017
C++ Memory Model
- Part 1
- Program order versus memory order
- Atomic operations
- Barriers
- Part 2
- A hardware model to explain acquire/release
- Sequential Consistency
HPX v1.1 released
HPX is a general purpose parallel C++ runtime system for applications of any scale. It implements all of the related facilities as defined by the C++ Standard. <…> HPX provides the only widely available open-source implementation of the new C++17 parallel algorithms. Additionally, HPX implements <…> large parts of the C++ Concurrency TS, task blocks, data-parallel algorithms, executors, index-based parallel for loops, and many more.
As a C++ developer I think that Rust is…
- is a good language but the community is toxic towards people not using Rust
- lacks function overloading, value generics, variadic generics and exceptions
- is much nicer, though I doubt I’ll get to use it in my current job any time soon
- solves a non-problem if you use modern C++
- is a topic way too often spawning on this C++ subreddit
- would have been a compelling alternative if it came out 10 years ago
- lacks library support
- less powerful but more user-friendly than C++