Category: Science & Technology

A Crash Course in Calendars, Dates, Time, and Time Zones – Marc Gregoire – CppCon 2021

  • Lobby
  • Science & Technology

https://cppcon.org/
https://github.com/CppCon/CppCon2020
---
Before C++11, the C++ Standard Library did not have much support for working with time. C++11 changed all that and introduced the chrono library as part of the Standard Library. With its introduction, C++ gained a standard way to work with durations, clocks, and time points. It allows you to perform arithmetic operations with durations and time points, to convert between different units of time, and more. The library also comes with a number of clocks, including a high-resolution clock which makes it easy to quickly time how long a piece of code executes, e.g. for benchmarking, all without needing any additional libraries.
C++20 has extended the chrono library and added support for calendars, dates, and time zones. It allows you to represent specific days of a year, even something like the 3rd Monday of July or the last day of February, and to perform arithmetic operations with dates. Time can now be expressed in specific time zones, and, of course, converting time between different time zones is supported as well.

---
Marc Gregoire

Marc Gregoireis a software architect from Belgium. He graduated from the University of Leuven, Belgium, with a degree in "Burgerlijk ingenieur in de computer wetenschappen" (equivalent to a master of science in engineering in computer science). The year after, he received an advanced master’s degree in artificial intelligence, cum laude, at the same university. After his studies, Marc started working for a software consultancy company called Ordina Belgium. As a consultant, he worked for Siemens and Nokia Siemens Networks on critical 2G and 3G software running on Solaris for telecom operators. This required working in international teams stretching from South America and the United States to Europe, the Middle East, Africa, and Asia. Now, Marc is a software architect at Nikon Metrology (www.nikonmetrology.com), a division of Nikon and a leading provider of precision optical instruments, X-ray machines, and metrology solutions for X-ray, CT, and 3-D geometric inspection.

His main expertise is C/C++, specifically Microsoft VC++ and the MFC framework. He has experience in developing C++ programs running 24/7 on Windows and Linux platforms: for example, KNX/EIB home automation software. In addition to C/C++, Marc also likes C#.

Since April 2007, he has received the annual Microsoft MVP (Most Valuable Professional) award for his Visual C++ expertise.

Marc is the founder of the Belgian C++ Users Group (www.becpp.org), author of “Professional C++” 2nd, 3rd, 4th, and 5th Editions (Wiley/Wrox), co-author of “C++ Standard Library Quick Reference” 1st and 2nd editions (Apress), a technical editor for numerous books for several publishers, and a regular speaker at the CppCon C++ conference. He maintains a blog at www.nuonsoft.com/blog/ and is passionate about traveling and gastronomic restaurants.

---
Videos Streamed & Edited by Digital Medium: http://online.digital-medium.co.uk

The CppCon YouTube Channel Is Sponsored By:
SonarSource: https://www.sonarsource.com/

Filed under: Science & Technology

Implementing C++ Modules: Lessons Learned, Lessons Abandoned – Cameron DaCamara & Gabriel Dos Reis

  • Lobby
  • Science & Technology

https://cppcon.org/
https://github.com/CppCon/CppCon2020
---
C++ Modules were designed to bring more safety to your programs, while dramatically reducing compile time, resulting in overall increased productivity. How can your C++ toolchain meet this challenge? What can you do to take advantage of these new functionalities available in your toolbox? In this talk, we share lessons learned from implementing Modules based on the singular idea of providing robust support through the entire toolchain (from the lexer through the linker, the IDE, the build system, etc.), debunking the misconception that C++ Modules are just some syntactic sugar that is compiled away by the front-end. The challenges that any C++ compiler implementer faces include: (1) how to satisfy the requirements of merging materialization of declarations -- needed for sound handling of the global module fragments, in particular, as found in header files and header units – with associated performance cost; (2) how to take advantage of the One Definition Rule guarantees provided by named modules. They must address those challenges without compromising efficiency and static semantics. These lessons are valuable not just to C++ tools developers, but to ordinary C++ programmers as well, shedding light on how speed and safety gains are achieved by staying close to the spirit of the original C++ Modules design (“take the ODR as foundational”), and how you can put them to good use in the architecture of your programs and libraries.

---
Cameron DaCamara

Senior software engineer at Microsoft working on the MSVC front-end team. Primary area of focus is C++ Modules and compiler evolution.

Gabriel Dos Reis

Gabriel Dos Reis is a Principal Software Engineer at Microsoft, where he works in the area of large scale software construction, tools, and techniques. He is also a researcher, and a longtime member of the C++ community, author and co-author of numerous extensions to support large scale programming, compile-time and generic programming. His research interests include programming tools for dependable software. Prior to joining Microsoft, he was Assistant Professor at Texas A&M University. Dr. Dos Reis was a recipient of the 2012 National Science Foundation CAREER award for his research in compilers for dependable computational mathematics and educational activities.

---
Videos Filmed & Edited by Bash Films: http://www.BashFilms.com

YouTube Channel Managed by Digital Medium Ltd https://events.digital-medium.co.uk

The CppCon YouTube Channel Is Sponsored By:
JetBrains : http://jb.gg/cpptools
SonarSource: https://www.sonarsource.com/

Filed under: Science & Technology

Warning: std::find() is Broken! – Sean Parent – CppCon 2021

  • Lobby
  • Science & Technology

https://cppcon.org/
https://github.com/CppCon/CppCon2020
---
We often take it for granted that calling one of the Standard algorithms will do something meaningful. For example, when invoking `position = find(first, last, value)` we expect that if an element equal to value is contained in the range `[first, last)` then `position` will point to the first such element; otherwise, position will equal `last`. But how do we know `find `will perform this operation? This talk explores requirements, guarantees, and domains, and we'll discover that maybe `find` doesn't.

---
Sean Parent
Adobe

Sean Parent is a senior principal scientist and software architect for Adobe’s Software Technology Lab (v2). Sean has been at Adobe since 1993 when he joined as a senior engineer working on Photoshop and later managed Adobe’s Software Technology Lab. In 2009 Sean spent a year at Google working on Chrome OS before returning to Adobe. From 1988 through 1993 Sean worked at Apple, where he was part of the system software team that developed the technologies allowing Apple’s successful transition to PowerPC.

---
Videos Filmed & Edited by Bash Films: http://www.BashFilms.com

The CppCon YouTube Channel Is Sponsored By:
SonarSource: https://www.sonarsource.com/

Filed under: Science & Technology

Dynamically Loaded Libraries Outside the Standard – Zhihao Yuan – CppCon 2021

  • Lobby
  • Science & Technology

https://cppcon.org/
https://github.com/CppCon/CppCon2020
---
You must be aware of dynamically-link libraries, but have you tried using them through LoadLibrary on Windows or dlopen on UNIX?

A library may be dynamically-linked, but not designed for being loaded at runtime. Likewise, we may load a library at runtime, but we may not need to unload it before the program exits. In other words, a library can be "dynamic" at different levels. Those dynamically loaded and dynamically unloaded are often more special than the ones that do not. However, the dark side is that the more dynamic a library is, the further they are apart from the C++ standard.

This talk will cover a few typical use cases of dynamically loaded libraries, such as delay loading, plugin system, live update. We will discuss their status quo on different platforms, tools for diagnosis, common practices, problems, and what standardization can do to them. These should inspire you about what to do when designing your next architecture that may involve dynamically loaded code.

---
Zhihao Yuan

Zhihao Yuan is an R&D Software Engineer at Symantec, a division of Broadcom. He participated in standardizing designated initializers and improved narrowing conversions in C++20 but ends up almost exclusively programmed in Python last year and only recently picked up C++14 again. He finished watching the first Macross, a 1982 animation, early this year.

---
Videos Streamed & Edited by Digital Medium: http://online.digital-medium.co.uk

The CppCon YouTube Channel Is Sponsored By:
SonarSource: https://www.sonarsource.com/

Filed under: Science & Technology

Back to Basics: Algorithmic Complexity – Amir Kirsh & Adam Segoli Schubert – CppCon 2021

  • Lobby
  • Science & Technology

https://cppcon.org/
https://github.com/CppCon/CppCon2020
---
When you're designing a program, how do you choose appropriate data structures and algorithms? How do you know when the proposed design is likely to be "too slow," without benchmarking the finished code? How can you avoid introducing inefficiencies into the code as you write it, without burning yourself out on "premature optimization"? Why do people always say the inner loop is the most important? How is it that the 10x speedup you committed yesterday was completely wiped out by a mere 2x increase in site traffic today?

In this session, we'll explore the notion of algorithmic complexity, especially as it relates to the data structures and algorithms provided by the C++ standard library, such as std::sort, std::find, and std::binary_search. With just a bit of informal math, we'll define "big-O notation" and demonstrate the differences between complexity classes such as O(1), O(lg n), and O(n). We'll show how to determine the big-O complexity of your own functions by counting loops (including the loops hidden inside STL algorithms and overloaded operators). Then we'll show how we can use limits — or a bit of geometric intuition — to determine that certain algorithms run in linear time despite their complex inner structure, and explain what we mean when we say that vector::push_back runs in "amortized constant time." Finally, we'll discuss ways to trade off space against time, or setup time against query time, and discuss some practical considerations such as constant factors and physical implementation limits.

---
Amir Kirsh

Amir Kirsh is both a Lecturer and a practitioner. Teaching at the Academic College of Tel-Aviv-Yaffo and at Tel-Aviv University while keeping hands on, mainly on C++, as a Dev Advocate at Incredibuild and previously as the Chief Programmer at Comverse. Amir is also one of the organizers of the CoreCpp conference in Tel-Aviv and the CoreCpp meetup group and a member of the Israeli ISO C++ National Body.

Adam Segoli Schubert

Adam is a software consultant, programming instructor, and part of the Dev Advocate office at Incredibuild. He also collaborates on projects which focus on decentralization, parallelization, and blockchain, with the objective of advancing transparency, freely available distributed knowledge, and autonomy.

---
Videos Filmed & Edited by Bash Films: http://www.BashFilms.com

YouTube Channel Managed by Digital Medium Ltd https://events.digital-medium.co.uk

The CppCon YouTube Channel Is Sponsored By:
JetBrains : http://jb.gg/cpptools
SonarSource: https://www.sonarsource.com/

Filed under: Science & Technology

C++23 Standard Library Preview – Jeff Garland – CppCon 2021

  • Lobby
  • Science & Technology

https://cppcon.org/
https://github.com/CppCon/CppCon2020
---
Despite the pandemic the C++ committee is continuing to work towards C++23. This survey presentation provides students with a broad overview of the changes and new facilities in the C++23 standard library.

The changes include a major expansion of ranges - including new view types like ~zip~ and algorithms like ~fold~ and ~starts_with~. For i/o there's a number of extensions to ~std::format~ facilities as well as a new i/o stream type, ~span_stream~ that allows for user supplied buffers in for i/o. In containers, we see the addition of ~flat_map~ and ~flat_set~. ~std::stacktrace~ provides a badly needed debugging capability. More ~constexpr~ library facilities include ~type_info~, ~std::variant~ and ~std::optional~. For interfaces with C there are changes for atomics and ~out_ptr~ to help with resource management. For functional programming monadic interfaces on ~optional~ are provided.

Fast paced, and chock full of example codes, this tutorial will focus on practical application of the new c++23 standard library facilities. Some of these topics will be covered very briefly, but with pointers in the slides for further study. The tutorial is up to date with the latest working draft will include pointers to current implementations as well as the state of compiler support.

---
Jeff Garland

Jeff Garland has worked on many large-scale, distributed software projects over the past 30+ years. The systems span many different domains including telephone switching, industrial process control, satellite ground control, ip-based communications, and financial systems. He has written C++ networked code for several large systems including the development high performance network servers and data distribution frameworks.Mr. Garland’s interest in Boost started in 2000 as a user. Since then he has developed Boost.date_time, become a moderator, served as a review manager for several libraries (including asio and serialization), administered the Boost wiki, and served as a mentor for Google Summer of Code. Mr. Garland holds a Master’s degree in Computer Science from Arizona State University and a Bachelor of Science in Systems Engineering from the University of Arizona. He is co-author of Large Scale Software Architecture: A Practical Guide Using UML. He is currently Principal Consultant for his own company: CrystalClear Software, Inc.

---
Videos Filmed & Edited by Bash Films: http://www.BashFilms.com

YouTube Channel Managed by Digital Medium Ltd https://events.digital-medium.co.uk

The CppCon YouTube Channel Is Sponsored By:
JetBrains : http://jb.gg/cpptools
SonarSource: https://www.sonarsource.com/

Filed under: Science & Technology

Combining Co-Routines and Functions into a Job System – Helmut Hlavacs – CppCon 2021

  • Lobby
  • Science & Technology

https://cppcon.org/
https://github.com/CppCon/CppCon2020
---
Every game engine today should have a job system that harvests the power of the available CPU cores. Additionally, C++20 has introduced co-routines, which can schedule other tasks and suspend until these tasks have finished. Due to this suspension, the thread the co-routine is running on is free to serve other jobs.

Using co-routines in a job system results in easy to read code, local variables do not go out of scope until the co-routine returns.

However, there is a price to pay. Co-routines demand to use their own machinery for suspension and synchronizing them with other co-routines. Mixing in functions, lambdas or functors that do not have access to this machinery proves to be a demanding task, especially if they should interact and synchronize with co-routines.

This talk presents the Vienna Game Job System (VGJS), a C++20 based job system that seamlessly combines co-routines with functions, lamdas and functors. Co-routines can synchronize with functions, and vice-versa. This way, programmers can always choose which form of job is appropriate - either create a co-routine (which incurs some overhead due to allocations from the heap and the co-routine machinery), or run a function, a functor, etc., with generally better performance.

Additionally, VGJS allows to create tagged jobs to be run later, e.g., if a game in the game loop goes sequentially through phases, and specific jobs should be run in them. VGJS also allows for collecting performance trace files to be visualized in Chrome, and supports memory resources to be used for its allocations.

The talk will also show performance differences between co-routines, functions, and fibers (co-routines that do not return).

---
Helmut Hlavacs

Dr. Helmut Hlavacs is Full Professor for Computer Science at the University of Vienna, Austria (ORCID: orcid.org/0000-0001-6837-674X). Dr. Hlavacs has a PhD in Mathematics (2001), and an MSc in Mathematics (1993). He also was awarded a Habilitation in the area of Applied Computer Science (2004). He currently heads a research group on Entertainment Computing, focusing here on technical aspects of computer games, game engines and C++, rendering with the Vulkan API, as well as application of computer games and virtual reality for well being, health, and anxiety therapy.

---
Videos Streamed & Edited by Digital Medium: http://online.digital-medium.co.uk

The CppCon YouTube Channel Is Sponsored By:
SonarSource: https://www.sonarsource.com/

Filed under: Science & Technology

Building an Extensible Type Serialization System Using Partial Template Specialization – CppCon 2021

  • Lobby
  • Science & Technology

https://cppcon.org/
https://github.com/CppCon/CppCon2020
---
As software engineers, we all prefer using performant libraries with user-friendly interfaces. But designing a template-free interface can be challenging for some C++ libraries, like serialization libraries, that need to support generic values but handle them differently based on their type.

This talk shows how we can leverage partial template specialization to implement a generic user-friendly API that can be extended to support custom user-defined types. As a proof of concept, I will showcase an extensible type serialization system, that is built on top of the FlatBuffers serialization library, and enables users to register custom serializers for their user-defined types to support their automatic serialization at runtime.

Template programming is generally known to be associated with long type names and indecipherable compile-time errors. This presentation includes examples and recommendations that help C++ engineers to create more expressive and easy-to-understand implementations. Finally, the talk describes how C++20 features like Concepts can further simplify those implementations and facilitate designing elegant user-friendly programming interfaces.

---
Pejman Ghorbanzade

Pejman Ghorbanzade is the Founder and CEO of Touca, helping software engineers understand the true impact of their code changes on the behavior and performance of their software. Before Touca, Pejman was a senior software engineer at Canon Medical Informatics building software for advanced visualization of medical images. Before that, he worked at VMware Carbon Black building and maintaining the macOS endpoint for the Cb Defense product. Pejman is interested in problems related to the design and maintenance of software at scale and over time. He is passionate about solutions to improve stability and maintainability of products with large ever-changing codebases. Over the years, his code changes have caused more than his fair share of issues in those products.

---
Videos Filmed & Edited by Bash Films: http://www.BashFilms.com

YouTube Channel Managed by Digital Medium Ltd https://events.digital-medium.co.uk

The CppCon YouTube Channel Is Sponsored By:
SonarSource: https://www.sonarsource.com/

Filed under: Science & Technology

Data Orientation For The Win! – Eduardo Madrid – CppCon 2021

  • Lobby
  • Science & Technology

https://cppcon.org/
https://github.com/CppCon/CppCon2020
---
C++ conferences have had presentations showing the important performance benefits of data-oriented design principles; however, the principles seem to require lots of "manual" effort and "code uglification"; these make the principles less practical, and there haven't been clear recommendations about how to deal with runtime-polymorphic types.

In this talk we will recapitulate on data orientation principles and their benefits showing their application through production-strength Generic Programming components made to support them.

Specific examples include:
1. Structures of arrays instead of arrays of complex structures (a.k.a. "scattering")
2. Support for data oriented designs for runtime-polymorphism without inheritance+virtual (the equivalent of using std::variant or std::function, but generalized as allowed by the Zoo type-erasure framework)
----1. Hybrid buffers: the equivalent of the virtual table pointer is scattered out of the objects solving the "Goldilocks problem" of how big the local buffer should be, objects occupy the available space optimally
----2. Easy (de)serialization through very easy relocatability
----3. Voiding the need for pointers in favor of indices into arrays

---
Eduardo Madrid

Eduardo has been working for many years on financial technologies, automated trading in particular, and other areas where performance challenges can be solved in C++. He contributes to open source projects and teaches advanced courses on Software Engineering with emphasis in Generic Programming

---
Videos Filmed & Edited by Bash Films: http://www.BashFilms.com

YouTube Channel Managed by Digital Medium Ltd https://events.digital-medium.co.uk

The CppCon YouTube Channel Is Sponsored By:
JetBrains: http://jb.gg/cpptools
SonarSource: https://www.sonarsource.com/

Filed under: Science & Technology

Why You Should Write Code That You Should Never Write – Daisy Hollman – CppCon 2021

  • Lobby
  • Science & Technology

https://cppcon.org/
https://github.com/CppCon/CppCon2020
---
During the COVID-19 global pandemic, as we all searched for ways to stay connected to the C++ community, I innocently started posting short, 25-line or less C++ snippets of counterintuitive C++ code that I called my "Cute C++ trick of the day." I was floored by the amount of attention these tweets received, with some being viewed more than 30,000 times and liked or retweeted hundreds of times. I received repeated requests to collect these tricks into a library or talk, and this is that talk.

In this presentation, I will dissect a few of my most popular "Cute C++ tricks" to a level of detail not possible on social media platforms like Twitter. I'll talk about how and why these tricks work the way they do, talk about the dark corners of C++ they touch upon, and talk about what you should actually do if you need to produce the same effect in production code. While not targeted at beginners, these tricks span the gauntlet from features that most intermediate programmers are aware of (but never thought to use in a particular way) to dark corners of the language that many of my C++ committee colleagues were surprised to learn about. Throughout it all runs a common thread: learning how to exploit your own curiosity to expand your toolbox, gain a better grasp of the fundamentals of C++, and ultimately, become a better programmer.

---
Daisy Hollman

Dr. Daisy S. Hollman has been a member of the C++ standards committee since 2016, where she has made contributions to a wide range of library and language features, including proposals related to executors, atomics, generic programming, futures, and multidimensional arrays. Since receiving her Ph.D. in Quantum Chemistry in 2013, her research has focussed primarily on parallel and concurrent programming models, though a broader focus on general accessibility of complex abstractions has become her focus in more recent years. She currently works on C++ language and library design at Google, where she continues to focus on providing broad accessibility of programming models and abstractions, with a particular focus on design for diversity and inclusivity.

---
Videos Filmed & Edited by Bash Films: http://www.BashFilms.com

YouTube Channel Managed by Digital Medium Ltd https://events.digital-medium.co.uk

The CppCon YouTube Channel Is Sponsored By:
JetBrains : http://jb.gg/cpptools
SonarSource: https://www.sonarsource.com/

Filed under: Science & Technology