Video & On-Demand

Functional Patterns in C++ -- Bartosz Milewski

bartosz-milewski-functional.pngIf you're familiar with functional language styles and you want an advanced look at how your favorite functional styles are supported in modern C++, with a dash of Haskell, check out these three videos by Bartosz Milewski:

Functional Patterns in C++ (slides)

by Bartosz Milewski

Part 1, Functors: First the introduction to some common functional patterns like Functor, which, surprisingly pops up everywhere. I'll show the example of a unique_ptr and a vector as Functors. Of course, this is only in preparation for asynchronous functors.

Part 2, Currying, Applicative: A little digression to Haskell and the Maybe functor and the explanation of currying. Then I'll show you the Applicative Functor pattern. This is, of course, in preparation for for the asynchronous applicative functor pattern.

Part 3, Asynchronous API, Monoid, Monad: The encapsulation of asynchronous API that doesn't lead to inversion of control and spaghetti code. Very natural example of a Monad Pattern.

Slides (parts 1-3)

Interestingly, Bartosz' talk ends with a plea for (essentially) future.then and a C#-style await... both of which are under active consideration in the C++ standards committee as part of a potential near-term C++ technical specification on concurrency and parallelism.

Image Watch: C++ image and video debugging plug-in for VS 2012

We continue to see modern C++ tool development across the industry continue apace. Here's another new cool C++-oriented tool with a nice seven-minute video on Channel 9:

Introducing Image Watch - A VS 2012 Plug-In for C++ Image and Video Debugging

Image Watch is a new Visual Studio 2012 plug-in for debugging C++ image and video processing applications, for example photo or augmented reality apps. Image Watch provides a watch window that can display in-memory bitmaps during debugging, so you no longer need to litter your code with "save-this-intermediate-image-to-a-file" statements when tracking down bugs. The initial release has built-in support for OpenCV image types and can be extended for viewing user-defined image types as well.

Here, Wolf Kienzle, Senior Research Developer, Interactive Visual Media group, Microsoft Research Redmond, explains and demos this excellent new tool for C++ developers building image, video or augmented reality apps. In effect, you can step into pixels...

atomic Weapons: The C++ Memory Model and Modern Hardware -- Herb Sutter

Herb Sutter's biggest and deepest talk at C++ and Beyond 2012 is now online:

atomic<> Weapons: The C++ Memory Model and Modern Hardware

by Herb Sutter

This session in one word: Deep.

It's a session that includes topics I've publicly said for years is Stuff You Shouldn't Need To Know and I Just Won't Teach, but it's becoming achingly clear that people do need to know about it. Achingly, heartbreakingly clear, because some hardware incents you to pull out the big guns to achieve top performance, and C++ programmers just are so addicted to full performance that they'll reach for the big red levers with the flashing warning lights. Since we can't keep people from pulling the big red levers, we'd better document the A to Z of what the levers actually do, so that people don't SCRAM unless they really, really, really meant to.

Topics Covered:

  • The facts: The C++11 memory model and what it requires you to do to make sure your code is correct and stays correct. We'll include clear answers to several FAQs: "how do the compiler and hardware cooperate to remember how to respect these rules?", "what is a race condition?", and the ageless one-hand-clapping question "how is a race condition like a debugger?"
  • The tools: The deep interrelationships and fundamental tradeoffs among mutexes, atomics, and fences/barriers. I'll try to convince you why standalone memory barriers are bad, and why barriers should always be associated with a specific load or store.
  • The unspeakables: I'll grudgingly and reluctantly talk about the Thing I Said I'd Never Teach That Programmers Should Never Need To Now: relaxed atomics. Don't use them! If you can avoid it. But here's what you need to know, even though it would be nice if you didn't need to know it.
  • The rapidly-changing hardware reality: How locks and atomics map to hardware instructions on ARM and x86/x64, and throw in POWER and Itanium for good measure – and I'll cover how and why the answers are actually different last year and this year, and how they will likely be different again a few years from now. We'll cover how the latest CPU and GPU hardware memory models are rapidly evolving, and how this directly affects C++ programmers.

Herb adds on his blog:

Note: This is about the basic structure and tools, not how to write lock-free algorithms using atomics. That next-level topic may be on deck for this year’s C++ and Beyond in December, we’ll see...

Core C++, 7 and 8 of N: Loops, ODR, and variadic array sorter

Two advanced talks by Stephan T. Lavavej (aka STL) are now available, the second being posted today:

Core C++, 7 of N

In Part 7, STL teaches us about Usual Arithmetic Conversions, Template Metaprogramming (TMP), and shares some of the Visual C++ STL internal implementation (some of it not yet released). Many of you have asked for some treatment of TMP and STL delivers!

Core C++, 8 of N

In part 8, STL digs into the do-while loop, casts, one definition rule (ODR), and his variadic template array sorter. There is a lot of information in this episode, so get comfortable, tune in, and learn.

C++ Concurrency - Herb Sutter

Another C++ and Beyond 2012 talk is now available online on Channel 9.

[Ed.: Note that the talk title and abstract should read as below. The initial Channel 9 video posting used an outdated title and abstract, and will be corrected soon.]

C++ and Beyond 2012: C++ Concurrency

by Herb Sutter

Herb says:

I've spoken and written on these topics before. Here's what's different about this talk:

 

  • Brand new: This material goes beyond what I've written and taught about before in my Effective Concurrency articles and courses.
  • Cutting-edge current: It covers the best-practices state of the art techniques and shipping tools, and what parts of that are standardized in C++11 already (the answer to that one may surprise you!) and what's en route to near-term standardization and why, with coverage of the latest discussions.
  • Blocking vs. non-blocking: What's the difference between blocking and non-blocking styles, why on earth would you care, which kinds does C++11 support, and how are we looking at rounding it out in C++1y?

The answers all matter to you – even the ones not yet in the C++ standard – because they are real, available in shipping products, and affect how you design your software today.

C++ and Beyond 2012: Panel - Convincing your Colleagues

A new C++ and Beyond 2012 panel is now available:

C++ and Beyond 2012: Panel - Convincing your Colleagues

From C++ and Beyond 2012, Andrei, Herb and Scott present Convincing Your Colleagues - an interactive panel.

Abstract:

You can't do a better job if you don't change what you're doing, but change is hard.  It's especially hard when what needs to change is your colleagues' approach to software development. Moving your team forward often requires persuading your peers to change their behavior, sometimes to do something they're not doing, other times to stop doing something they've become accustomed to.  Whether the issue is to embrace or avoid C++ language features, to adopt new development tools or abandon old ones, to increase use of or scale back on overuse of design patterns, to adhere to coding standards, or any of the plethora of other matters that affect software creation, moving things forward typically requires getting your colleagues to buy into the change you're proposing.  But how can you do that?

In this panel session, Andrei, Herb, and Scott share how they go about convincing their colleagues to change and take questions from the audience.

 

You Don't Know const and mutable -- Herb Sutter

In August, Herb Sutter gave a brand new 30-min talk at C++ and Beyond where he laid out the fundamentally new meanings of two long-time C++ keywords:

You Don't Know [const] and [mutable]

Herb Sutter

There’s a major change in C++11 that [...] rewrites pre-C++11 design guidance and is directly related to writing solid code in a concurrent and parallel world. And it isn’t just academic — everyone is going to have to learn and apply the new C++11 guidance that we’ll cover in this session.

This is a great example of how C++11 is a simpler language: We can stop the Cold War-era waffling about subtleties about what 20th-century C++ const means, and proudly declare modern C++ const has the simple and natural and "obvious" meaning that most people expected all along anyway.

One of the most common questions after the talk was, "Do other C++ experts agree with Herb's conclusions?" The answer is yes -- regarding his upcoming The C++ Programming Language, Fourth Edition, Bjarne Stroustrup writes: "I do point out that const means immutable and absence of race conditions in the last Tour chapter. I plan more for the concurrency chapter." Look for the third Tour chapter to be posted here next week, and the aforementioned last Tour chapter to be posted here in early February.

Enjoy.

Best of 2012: Clang @ GoingNative -- Chandler Carruth

As we're all unwinding at the end of the year, your blog staff would like to recommend watching again one of the year's most hilariously entertaining and deeply informative talks about the world's hottest new C++ compiler -- a holiday video that's genuinely fun:

Clang: Defending C++ from Murphy's Million Monkeys

by Chandler Carruth
at GoingNative 2012

[... Clang] provides fantastic diagnostics, static and dynamic program analysis, advanced rewriting and refactoring functionality, and language extensibility. Together with improvements to the language in C++11 these help programmers cope with today's code and write better code tomorrow. Clang also makes it easier than ever before to evolve and evaluate new language features and extensions to make C++ itself better.

Through this talk I'll give some background on the Clang compiler, what it does today to make writing C++ better, and how we're using it to help shape the C++ language going forward.

Even your non-technical family and friends will probably enjoy the first five minutes.

Thanks again to Chandler, GoingNative, and Channel 9 for an engaging and illuminating presentation.

 

Three Optimization Tips for C++ -- Andrei Alexandrescu

For your Friday viewing pleasure, from the always-engaging master, Andrei Alexandrescu:

Three Optimization Tips for C++ (video) (PDF slides)

Andrei Alexandrescu

Facebook NYC, December 4, 2012

 

From an early slide in the talk: "Intuition:

  • Ignores aspects of a complex reality
  • Makes narrow/wrong/obsolete assumptions

[...]

  • The only good intuition: "I should time this."

​Enjoy.

(Bonus: The tips are also applicable in other languages. They just happen to be easier to use and control in C++.)