📜 ⬆️ ⬇️

Reports from the spring conference C ++ Russia 2018


From April 19 to April 21 in St. Petersburg, the C ++ Russia 2018 conference was held. From year to year, organization and holding becomes one level higher, which is good news. Thanks to the permanent organizer of C ++ Russia Sergey Platonov for his contribution to the development of this area.

Master classes were scheduled for April 19, which, unfortunately, we could not attend, and 20-21 the main program of the conference was held, in which we participated with great interest. Sergei sermp did a great job and attracted several wonderful foreign speakers to the presenters. The first day of the conference was opened by Jon Kalb, the organizer of CppCon and the author of the book C ++ Today: The Beast is Back. The second day began with a report by Daveed Vandevoorde, a member of the standardization committee, one of the authors of the book C ++ Templates: The Complete Guide. In the epicenter of attention was Andrei Alexandrescu, who, after his report on exceptions, at one point gathered a whole crowd of people who wanted to get an autograph and make a joint photo. For the first time, a Herb Sutter report was broadcast on Skype telling about the Spaceship operator for C ++ 20.

Although the conference was already held more than 3 months ago, the video ( full playlist ) was posted on it just now, so it's time to refresh the memories and immerse yourself in the amazing possibilities of C ++.

Jon Kalb. C ++ Today: The Beast is Back



C ++. It is a concept. In the case of data flow This talk explains why C ++ is the most software engineers' go-to language for performance. It makes it easy for you to get up to speeds.
')

Arno Schödl. From Iterators To Ranges



Pairs of iterators are ubiquitous throughout the C ++ library. It is generally accepted that combining such a pair is usually termed Range delivers more concise and readable code. Defining the semantics of such range concept proves surprisingly tricky, however. Theoretical considerations conflict with practical ones. Some design goals are mutually incompatible altogether.

Jonathan Boccara. 105 STL Algorithms in Less Than an Hour



We are all aware of the STL algorithms. Including expressions and more. And sometimes, in a spectacular way.

But do you know your STL algorithms?

In this talk, the author presents 105 options for the STL currently has, including those added in C ++ 11 and C ++ 17. This is a list of the algorithms that relate to each STL.

For more information, please click here for more information.

Viktor Kirilov. Interactive C ++ Compilation (REPL): The Lean Way



C ++ program is running, it’s not a trivial message? Scripting languages ​​have a REPL (read-eval-print-loop). The C ++ has been cling (developed by researchers at CERN) and it is very much more cumbersome to set up. RCRL (Read-Compile-Run-Loop) is a demo project that demonstrates an innovative approach to compile and run. In this presentation, it can be modified.

Victor Ciura. Enough string_view to hang ourselves



Wouldn't it be a standard C ++ type to represent strings? Oh, wait ... we do: std :: string. If you’ve been using our whole application / project? Well ... we can't! Unless we're writing a console app or a service. But if you’re writing a non-standard C ++ string type. It may be CString from MFC or ATL, Platform :: String from WinRT, QString from Qt, wxString from wxWidgets, etc. Ohhhhh, for the family of cs ...

So we ended up with our codebase. OK, that’s what you need to manage. We'll make it a little bit unnecessary for you to juggling two types of strings; but that's glue code, anyway ... right?

It's a good plan ... until our project utilizes lots of string utilities and algorithms. Do we restrict those algorithmic goodies to std :: string? Do you want to have a C ++ type? Is C ++ 17 std :: string_view the answer to all our string problems?

It is an actively developed C ++ project, which has been developed for the C ++ 17, thanks to the clang-tidy. and "Clang Power Tools" ( www.clangpowertools.com) ...

Andrei Alexandrescu. Expect the expected



It is a pain point in all languages. In the course of this process, it is not a problem.

It can be combined with the package. It can be used for both localized (error-code-style) and centralized (exception-style).

Borislav Stanimirov. DynaMix: A New Take on Polymorphism



Software for business systems, such as games, systems, and enterprise systems, often need to be able to do this. Standard C ++ has rigid types. Languages ​​with lua, Python, and JavaScript make this very easy. Therefore, it is possible to keep the code readable and maintainable by these languages ​​alongside C ++. This is a combination of the most common and most complexbacks.

In the case of C ++, it is possible to make It would be possible to follow the example of a small demo.

Mikhail Matrosov. Versatile C ++ applied



In C ++, you can solve multiple ways. It includes: STL containers, boost.range, C ++ 20 ranges, coroutines. It can be easily compared with any other code. If you need a selection of statements with initializer, std :: not_fn, etc. Special attention is paid to topic - standard.

Alexander Granin. Functional approach to Software Transactional Memory



Parallel programming is a very multifaceted and deep topic. For dozens of years of research, a huge number of approaches, practices and tools have been developed, but we can hardly believe that C ++ has kept up with these trends. Starting with the C ++ standard 11, concepts such as std :: thread, std :: atomic, std :: future, std :: mutex were introduced, and in the future it is expected that coroutines, an asynchronous computing model, will be added. Well, these are all interesting things to learn, but the talk in the report will deal with a completely different idea.

Software Transactional Memory (STM) - the concept of a transactionally variable data model - has existed for a long time and has a number of implementations for all languages. With the help of STM, you express your data model, and run it to change in several streams, competitively, while you do not need to worry about synchronization of streams, about the valid state of data, about locks. STM will do everything for you. It sounds very good, but not all STM libraries are equally useful. Traditional imperative STMs are very complex, subject to non-trivial multithreaded bugs, and difficult to use. On the other hand, in the functional programming world, the concept of combinatorial STM has long existed, in which transactions are composable building blocks from which you build higher-level transactions. The combinatorial approach to STM makes it possible to express a competitive data model more flexibly, clearly and reliably. Parallel programming can also be enjoyable!

In the report, the author will talk about the features of the combinatorial STM, how to use it, and how it can be implemented in C ++ 17.

Vadim Vinnik. Collection Processing. Single essence, multiple manifestations



It is a very common practical tasks. It can be used for a very wide range of variables, array, linked list, tree, hash table, file et al. However, it’s not a problem. This is a concept for a group of individuals.

Dmitry Banshchikov. Shared libraries without external dependencies



The author will tell about his experience in developing an antivirus engine in C ++ as a shared library. A unique feature is the absence of any external dependencies (runtime C ++ or C). This whole bunch is built around using the custom toolchain on GCC for a special target, which is used by libc newlib for the same target, on top of which libstdc ++ is built. Accordingly, the shared library is built through a custom toolchain with custom libgcc_s, libc, libcstdc ++ (changes only in the assembly). All interaction with the runtime is done through the shared library ABI. Thus, inside the library, it is possible to use a fully-fledged modern C ++ without restrictions (RTTI, exceptions, iostream, etc), which goes into libstdc ++ libc (newlib) | l ibgcc-abi. A similar approach was tested on GCC / newlib / libstdc ++ for Linux, and clang / newlib / libc ++ for MacOS. The report may be of interest to those who want to use C ++ in shared libraries, but cannot afford it due to external dependencies.

Ilya Shishkov. How to teach the C ++ language: the experience of creating courses on Coursera



Over the past year and a half, the author has led the creation of a specialization on Coursera on modern C ++. The specialization will consist of five courses, two of which are already running, and one more is almost ready.

The report will tell:


In addition, during the work on the specialization a set of principles was developed, which are applicable in everyday work:


Therefore, the author does not just want to tell you how they are doing specialization, but also tries to shift the experience gained to everyday tasks.

Ivan Ponomarev. Crash reports Android NDK



It's not a secret that C / C ++ development places much higher demands on the quality of the code than Java development. The probability of making a fatal mistake is much higher. At the same time, collecting information about such errors is a non-trivial task even for experienced programmers.

The first part of the report will briefly review the existing developments: how the built-in Android debugger works, what solutions already exist. The second part is devoted to the story of how it works “under the hood”: how to get the processor status at the time of the error, how to unwind the call stack, how to find the line numbers in the source code. An overview of such stack promotion libraries as libcorkscrew, libunwind, libunwindstack will be given.

The report will be of interest to both Android developers, whose applications use NDK, and everyone else to expand their horizons.

Fedor Short. Memory is the perfect abstraction



int * ptr = new int;
* ptr = 42;
delete ptr;

What actually happens when these 3 lines of code are executed? We will look inside the memory allocator, operating system and modern hardware to give an exhaustive answer to this question.

Alexey Salmin. Memory Management Tips & Tricks



In 2017, the issue of choosing an allocator in C ++ does not lose its relevance. A new method has been added to the standard to select a local allocator for containers (std :: pmr), global tcmalloc and jemalloc continue to evolve, as do the kernel interfaces on which they rely. This report is devoted to the “bottom floor” of this design: the features of mmap and madvise in the Linux kernel and the influence of these features on the performance of the allocators.

Herb Sutter. New in C ++ 20: The spaceship operator



The new spaceship was recently adopted as a language feature for C ++ 20. The design of the space ship’s design For more information, it’s possible to make it easier to avoid any problem.

Anastasia Kazakova. Debugging C ++ Code, Without Running and Compiling



When you look at patterns, reflection, code generation at the compilation stage, metaclasses, there is a feeling that C ++ set itself the task of “hiding” the final code from the developer as much as possible. And the nontrivial use of the preprocessor (and numerous branches) can make the program's sequence of actions very non-obvious. Of course, these approaches save developers from endless copy-paste and repeating similar parts of the code base, but they require more advanced support in development tools.

Is it possible to debug the code without continuously restarting it, without a debugger, and even without simply compiling the entire codebase? Is it possible to find errors in code that cannot be built or run on a local machine? There is! Integrated Development Environments (IDEs) have extensive knowledge and understanding of custom code, and they can provide the appropriate tools.

This report will show you how to “debug” macro substitutions nested by typedef, understand the types of variables (which are often “hidden” in modern C ++), debug different branches of the preprocessor or operator overloads, and much more with the help of truly intelligent IDE. Some of the features are already available in CLion and ReSharper C ++, and some are just interesting ideas for the future that would be interesting to discuss with the audience.

Evgeny Lukyanets. Docker build using Conan



You can move the C ++ project assembly inside the docker container, instead of installing the necessary libraries and dependencies into the host system, you can either install them directly into the docker image (for example, Cuda), or install them using the C ++ manager of the Conan libraries (for example, Boost). This results in an isolated controlled (and each time the same) environment for the assembly, in which the Conan cache can be plugged in, so different projects using the same libraries will use the same assemblies. It also eliminates the dependence of the assembly on the Linux distribution, in which the project is assembled, the main thing is that you can run Docker on this distribution.

Denis Panin. Practical metaprogramming: writing a heterogeneous hash table



During the talk, we will write a small library of working with std :: tuple. With the help of this library we will make a compile-time heterogeneous hash table. Next - on its basis, we will write a small RPC framework, using the fact that we do not have type erasure.

There will be a lot of constexpr-calculations, templates and new features of C ++ 17 (specifically, if constexpr).

Dmitry Sokolov. Kodogeneratsiya as reflection for the poor



Reflection is often needed to generalize the serialization algorithms. Implementation of various protocols, work with databases. To solve such problems, we have written the homebrew IDL compiler for generating C ++ structures and a library for interacting with the result. Protobuf with pedals and whether it was worth it.

Daveed Vandevoorde. Reflective Metaprogramming in C ++



Some time ago, the C ++ standardization committee created a subgroup "SG-7". More recently, it has been added that it will be possible to make a decision on the eventual solution. C ++ 's first-class support of "reflective metaprogramming".

Dietmar KĂĽhl. Concept Based Testing



With concepts being added, it is expected that new concepts get defined. Each concept defines a set of operations used by generic code. One such use could be a generic test verifying that there is a concept and defined generic interactions between a concept's operations. Ideally, such a test will only work with the concept of guidelines for implementation of classes.

But it doesn’t make it possible to use the features of C ++ 17. If the test is taken, it can be used to determine the case. The concept of generic tests should be able to cover a concept. Obviously, for classes will still require corresponding tests.

Simon Brand. Modern C ++ Parallelism from CPU to GPU



It can be used to take advantage of multi-core and heterogeneous architectures and can significantly increase the performance of software. Modern C ++ has gone a long way to making parallel programming easier and more accessible; providing both high-level and low-level abstractions. C ++ 17 takes this further by providing C ++ 20. This report gives you a synopsis of SYCL.

Andrey Karpov. Effective C ++ (Myers has nothing to do with it :)



The C ++ language and the infrastructure around it continues to actively develop, which makes this language one of the most effective tools at present. I would like to highlight three factors that make the C ++ language so attractive now.


This report is an ode to the C ++ programming language!

Ivan Puzyrevsky. Asynchrony in programming



In the development of high-load multi-threaded or distributed applications, one can increasingly hear conversations about asynchronous code, including speculation about the need (no need) to take into account asynchrony in the code, about clarity (incomprehensibility) of asynchronous code, about its effectiveness (inefficiency). In this report, we will try to dive deeper into the subject area: analyze what asynchrony is; when it arises; how does it affect the code we write and the programming language we use. We will try to figure out what the futures & promises are about, let's talk a little about the corutines and actors. Let's touch on JavaScript and operating systems. The purpose of the report is to make more obvious the trade-offs that arise with a particular approach to developing multi-threaded or distributed software.

Pavel Bulatov. Switching to WebAssembly: Is the game worth the candle?



The report will discuss the current state of WebAssembly with respect to real products. We will tell you about our experience in porting an application, what problems arose and how we solved them.

Topics will be covered:


Dmitry Kozhevnikov. CMake pitfalls and where they live



The CMake build system is gradually becoming the de facto standard for cross-platform C ++ programming. However, it is often subject to fair criticism, including for inconvenient scripting language, outdated documentation and for the fact that the same tasks can be performed in different ways, while it is difficult to understand which one is more correct in a particular situation. . The author will tell:


Sergey Shambir. When procedural C ++ is good



The pure architecture of the project, simple abstractions on each layer are the dream of any team. For the realization of this dream, many object-oriented techniques have been invented. Being carried away by OOP, developers forget to monitor the cleanliness of the code at the junction of C and C ++. It is here that the procedural style will help bring order, build convenient and safe abstractions that are easily intertwined with the object-oriented code of the project. We will find out:


Yevgeny Zuev. Semantic API for C ++ programs



His professional interests are the semantics of programming languages, the design and implementation of PL compilers and other language-oriented tools. Among the most significant achievements are participation in such projects as the creation of a full standard C ++ compiler (Interstron, Moscow, 2000), the implementation of the Zonnon compiler for .NET (ETH Zurich, 2005), the implementation of the Swift compiler prototype for the Tizen platform ( Samsung Research Institute, Moscow, 2015).

Ivan Čukić. 2020: A void_t odyssey



C ++ has always been a powerful way to achieve polymorhpic execution without inheritance. The problem was that it was awkward and unnecessarily verbose.

For C ++ 20, it has been improved to make it easy to understand and understand.

In this talk, it’s a meta-function.

Evgeny Okhotnikov. Actors in C ++: was it worth it?



The author of the report has been responsible for the development of the SObjectizer framework Open-Source for 16 years. It is one of the few living and developing cross-platform actor frameworks for C ++. Development of SObjectizer began in 2002, when C ++ was among the most popular and widely used programming languages. Since then, C ++ has changed a lot, and the attitude towards C ++ has changed even more. The report will discuss how these changes affected the development of the tool with a 16-year history and how easy and convenient it was to make such a tool for the C ++ language. And whether it was necessary to make such a tool for C ++ in general.

Rainer grimm. Best Practices for Concurrency in Modern C ++



With the standardization of C ++ 11, we got a multithreading library and a memory model. The library has the basic building blocks such as atomics, threads, tasks, locks, and condition variables. This is a model for building blocks.

Later, it is possible to use multithreading and the memory model. This is a list of rules for the memory model. Best practices is far beyond C ++.

Alexey Malov. Experience of using modern C ++ in the development of desktop applications



The talk will be about C ++ tools and Boost and STL libraries, as well as architectural approaches to building GUI applications, which we used in developing a tool for creating video lessons.


Sergey Vasiliev. Static analysis: looking for bugs ... and vulnerabilities?



News about the next vulnerability found regularly surface here and there. The collateral losses of $ are usually colossal. Therefore, instead of fixing vulnerabilities, you should not allow them to appear.

One way to deal with errors in code is to use static analysis. But how suitable is it for finding vulnerabilities? And is there a big difference between simple errors and vulnerabilities in terms of code?

We will discuss these questions in the course of the report, and at the same time we will talk about how to use static analysis so as to extract maximum benefit from it.

PS

From myself I want to draw your attention to the mini-intrigue around std :: string associated with the reports of my colleague Andrei Karpov. So, in order:

  1. Fragment of Andrei’s report (C ++ Russia 2016) “Private stories from code analyzer developers” from 30:05 - link .
  2. Easy trolling such as we are from Anton Polukhin (C ++ Russia 2017) in the report “How not to do it: C ++ cycling for professionals” from 2:00 - link .
  3. Andrey's story at the C ++ Russia 2018 conference that we are not dinosaurs and learn new things: “Effective C ++” from 12:21 - link .

That's all! Have a nice acquaintance with the reports.

Source: https://habr.com/ru/post/418645/


All Articles