CppCon 2017: Type Punning in C++17: Avoiding Pun-defined Behavior--Scott Schurr

Have you registered for CppCon 2018 in September? Registration is open now.

While we wait for this year’s event, we’re featuring videos of some of the 100+ talks from CppCon 2017 for you to enjoy. Here is today’s feature:

Type Punning in C++17: Avoiding Pun-defined Behavior

by Scott Schurr

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

Type punning, treating a type as though it is a different type, has a long and sordid history in C and C++. But, as much as we'd like to deny its existence, it plays an important role in efficient low-level code. If you've ever written a program that examines the individual bits of a pointer or of a floating point number, then you've done type punning.

Given its long legacy, some of the techniques for type punning that were appropriate, even encouraged, earlier in history now live in the realm of undefined behavior. We'll identify which techniques are now proscribed and postulate why. We'll also explore ways to do type punning in C++17 that sidestep undefined behavior and are hopefully as efficient as the older techniques.

In this session we will look at:
o Common (and some uncommon) motivations for type punning.
o Techniques for type punning, both good and bad, all ugly.
o Related topics (like type conversions and std::launder()) with an eye toward unspecified and undefined behavior.

Metashell 4.0.0 is available

Metashell provides a compile-time debugger for debugging template instantiations and macro usage.

Metashell 4.0.0 is available

From the website:

Some of the major new features in 4.0.0:

  • The template debugger supports the Templight patch already merged into Clang (7.0.0), therefore it does not require custom Clang builds.
  • Preprocessor shell support for GCC, MSVC and Boost.Wave
  • PDB, the preprocessor debugger (similar to MDB, the template debugger)
  • Using different configs in Metashell (for testing the same templates/macros with different compilers)

The full list of changes can be found here.

An online demo can be found at http://metashell.org/about/demo/

Installers can be downloaded from http://metashell.org/getting_metashell/installers#version-400

Free C++ Course

Free C++ course starting 18th September 2018.

Free C++ Cour​se

About the course:

This is free course, aimed at beginners and intermediate users. Our syllabus is based on Programming: Principles and Practice Using C++, 2nd Edition.

Who can benefit from this course:

  1. People who have no experience with coding
  2. People that come from different languages such as Java, Python, C# etc
  3. Developers that would like to refresh their C++ knowledge

Location:

Please check our website for up to date details www.CPPLondonUni.com

London and Online

London - CodeNode 10 South Pl, London EC2M 7EB

Online - https://goo.gl/BqMCgj (Please RSVP on our host website https:://skillsmatter.com)

When:

Every Tuesday lecture

London - from 18:15 GMT

Online - from 18:30 GMT or soon after

Every Thursday workshop

London - from 18:15 GMT

CppCon 2017: When a Microsecond Is an Eternity: High Performance Trading Systems in C++--Carl Cook

Have you registered for CppCon 2018 in September? Registration is open now.

While we wait for this year’s event, we’re featuring videos of some of the 100+ talks from CppCon 2017 for you to enjoy. Here is today’s feature:

When a Microsecond Is an Eternity: High Performance Trading Systems in C++

by Carl Cook

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

Automated trading involves submitting electronic orders rapidly when opportunities arise. But it’s harder than it seems: either your system is the fastest and you make the trade, or you get nothing.

This is a considerable challenge for any C++ developer - the critical path is only a fraction of the total codebase, it is invoked infrequently and unpredictably, yet must execute quickly and without delay. Unfortunately we can’t rely on the help of compilers, operating systems and standard hardware, as they typically aim for maximum throughput and fairness across all processes.

This talk describes how successful low latency trading systems can be developed in C++, demonstrating common coding techniques used to reduce execution times. While automated trading is used as the motivation for this talk, the topics discussed are equally valid to other domains such as game development and soft real-time processing.

CppCast Episode 165: Formal Verification with Matt Fernandez

Episode 165 of CppCast the only podcast for C++ developers by C++ developers. In this episode Rob and Jason are joined by Matt Fernandez from Intel Labs to discuss Formal Verification.

CppCast Episode 165: Formal Verification with Matt Fernandez

by Rob Irving and Jason Turner

About the interviewee:

Matthew Fernandez is a Research Scientist with Intel Labs. Matt began his programming career building Windows GUI applications and designing databases, before moving into operating system architecture and security. He has a PhD in formal verification of operating systems from the University of New South Wales in Australia, and worked with the Australian research group Data61. In the past, he has worked on compilers, device drivers and hypervisors, and now spends his days exploring new tools and techniques for functional correctness and verification of security properties. On the weekends, you can usually find Matt in a park with a good book, hunting for good coffee or helping a newbie debug their code. He hopes to avoid saying “monad” on this podcast.

CppCon 2017: Building Better Worlds: Developing a Procedural City Tool for Alien...--Alan Bucior

Have you registered for CppCon 2018 in September? Registration is open now.

While we wait for this year’s event, we’re featuring videos of some of the 100+ talks from CppCon 2017 for you to enjoy. Here is today’s feature:

Building Better Worlds: Developing a Procedural City Tool for Alien...

by Alan Bucior

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

When MPC was asked to create a massive CG city for the film Alien: Covenant, they looked to leverage procedural generation as a means for iterating on the overall shape and structure of the city, in place of a prohibitively large team of environment artists. After evaluating all the practical third party options, it was ultimately decided that the best option was to build a custom tool to procedurally assist artists' city-building skills. This allowed for rapid iteration on the overall look of the city by striking a balance between manual and procedural techniques.

The core algorithms were written in C++ for speed. The user interface was written in Python to accommodate quick feature changes, and a dash of Fabric Engine's KL helped with model import and rendering. This multi-language approach allowed the consistent application of the "best tool for the job" rule, which is a common pattern at MPC, allowing flexible teams with experts in a variety of skillsets.

This talk will detail the history and development of MPC's city building tool, "Machi". Alan Bucior, Lead Developer of Machi, reviews the algorithms for city layout and building placement, discusses how to implement algorithms in an artist-driven manner, and shares various insights gleaned through the development process and discussion with stakeholders.

Use the official Boost.Hana with MSVC 2017 Update 8 compiler--Bat-Ulzii Luvsanbat

Getting more conforming!

Use the official Boost.Hana with MSVC 2017 Update 8 compiler

by Bat-Ulzii Luvsanbat

From the article:

We would like to share a progress update to our previous announcement regarding enabling Boost.Hana with MSVC compiler. Just as a quick background, Louis Dionne, the Boost.Hana author, and us have jointly agreed to provide a version of Boost.Hana in vcpkg to promote usage of the library among more C++ users from the Visual C++ community. We’ve identified a set of blocking bugs and workarounds and called them out in our previous blog, and stated that as we fix the remaining bugs, we will gradually update the version of Boost.Hana in vcpkg, ultimately removing it and replacing it with master repo. We can conduct this development publicly in vcpkg without hindering new users who take a dependency on the library...

Modern C++: 7 Ways to Fake It Until You Have It--Jonathan Boccara

If you want.

Modern C++: 7 Ways to Fake It Until You Have It

by Jonathan Boccara

From the article:

Do you wish you had a later version of C++ in your production code? If you do, you’re not alone: a lot of C++ developers today don’t work with a compiler that supports the latest version of the standard.

It could be for many reasons: perhaps you have a lot of legacy code to migrate, or your clients do, or your hardware doesn’t have the adequate infrastructure yet. The point is, you can’t benefit from the latest features that the language offers, and that’s a shame because some of them would surely make your code more expressive.

But even if you can’t use those features, you don’t have to give up on their benefits. At least some of their benefits. There are way you could use the ideas of the new features in your code, to convey your intents more precisely.

Sure enough, it’s not as good as having them natively, which is why updating your compilers is still a necessity. But in the meantime, here are 7 ways to emulate those features, that will improve your code at a minimal cost...