Lambdas Talk: Tomorrow night @ NWCPP, Redmond WA USA

For those of you who are local to the greater Seattle area, tomorrow night at 6:30pm in Redmond I’ll be giving a reprise of one my talks that premiered last fall at C++ and Beyond 2010.

The talk I’ll be giving is Lambdas, Lambdas Everywhere about all the wild and wonderful uses of C++0x lambda functions. It’s hosted by the Northwest C++ Users Group (NWCPP) which meets at Microsoft Building 41 in Redmond, WA.

Here are the coordinates, with a map link:

Lambdas, Lambdas Everywhere
Herb Sutter

Wednesday, May 18, 2011
6:30pm – pizza provided by Corensic
7:00pm – talk starts

Microsoft Building 41
Townsend Room (main floor directly off the lobby)
Southwest corner of NE 31st St and 156th Ave NE
Redmond, WA 98052

I look forward to seeing many of you tomorrow night.

Interview on Channel 9

Channel 9 just posted a new interview with me about ISO C++0x, C++’s place in the modern world, and all things C++. The topics we talked about ranged pretty widely, as you can see from the questions below.

Here’s the blurb as posted on Channel 9 with links to specific questions in the interview. Enjoy.

Herb

I was lucky enough to catch up with Herb Sutter not too long after the FDIS announcement (Final Draft International Standard is complete).

As usual when talking to Herb, the conversation is all about C++ (well, we do talk about C# for a little while, but in the context of C++. Why? Tune in…).

See below for the specific questions that were asked. You can simply click on a link to move directly to that point in the conversation. I do, however, strongly recommend that you watch the entire thing. I also recommend that you don’t get used to this level of categorization in my videos (it takes a fair amount of time to do this sort of thing, so enjoy the times when I actually do this, but don’t expect me to do this all of the time).

It’s always great to talk to Herb and get a glimpse of what goes on in the C++ Standards Committee (which Herb chairs). In this specific conversation, it’s uplifting to see how excited Herb is for the future of one of the world’s most capable and widely used general purpose programming languages. C++ is a modern programming language for power and performance, but it’s also a highly abstracted general purpose language for building user mode applications, mobile apps, etc. The amazing part is how C++ can provide rich general programming abstractions and also ensure that your code can run at machine speeds. We talk about this, of course.

Tune in. Learn. Go native!

1:37 -> What were the goals of the C++0x standard, at a high level?

2:40 -> Language and Library abstractions and performance (how high can you go and still be fast as possible?)…

5:23 -> C++ as an application development language (in addition to the traditional C++ is a systems programming language meme)…

07:17 -> C++0x or can we now call it C++11?

09:21 -> Standards committees and real world user representation…

10:39 -> Who comes up with the new features that get standardized (or not…)?

13:01 -> What were the goals of the C++0x standard (non-canned answer)?

14:21 -> What does Bjarne mean by C++0x being a better C++ for novice programmers?

15:51 -> Why can’t C++ look more like C#?

18:50 -> At the end of the day, everything(in terms of programmer-controlled computing) boils down to memory, right?

23:12 -> What are some of the most significant new features in C++0x?

25:05 -> What can VC++ developers expect to see in terms of C++0x implementation in Visual C++ next?

27:09 -> C++ and type safety…

29:05 -> C++0x and backwards compatibility: any big breaking changes?

34:16 -> C++0x in the Standard Library…

37:01 -> Any thinking in the Committee about doing more frequent experimental releases C++?

39:04 -> Are their features that didn’t make it into the standard that you really wanted to be standardized?

41:45 -> Are you comfortable with C++’s current state? Is it modern enough?

43:22 -> Conclusion (or Charles doesn’t end the conversation when his farewell begins – where does it go from there? )

Two More C&B Sessions: C++0x Memory Model (Scott) and Exceptional C++0x (me)

Scott Meyers, Andrei Alexandrescu and I are continuing to craft and announce the technical program for C++ and Beyond (C&B) 2011, and two more sessions are now posted. All talks are brand-new material created specifically for C&B 2011. Here are short blurbs; follow the links for longer descriptions.

  • Scott will give a great new talk on “The C++0x Memory Model and Why You Care” that will cover topics of interest to anybody who cares about concurrency and parallel programming under C++0x: everything from compiler optimizations and memory access reorderings, to “sequenced before” and “happens before” relations, to atomic types and memory consistency models, and how they all relate to both correctness and performance. This is stuff that in a perfect world nobody should ever have to know, but in our actual world every modern C++ developer who cares about correct high-performance code has to understand it thoroughly.
  • I’ll be giving a brand-new talk  “Exceptional C++0x (aka C++11)” that shows how the new features in C++0x change the way we solve problems, our C++ coding style, and even the way we think about our code. I’ll demonstrate that with code that works today on existing compilers, using selected familiar examples from my Exceptional C++ books. This is not rehashed material, as I’ll assume you’re already familiar with the pre-C++0x solutions (I’ll provide links to read as refreshers before the course), and then we’ll analyze and solve them entirely the 21st-century C++ way and see why C++0x feels like a whole new fresh language that leads to different approaches, new and changed guidelines, and even better solutions. As Bjarne put it: “Surprisingly, C++0x feels like a new language: The pieces just fit together better than they used to and I find a higher-level style of programming more natural than before and as efficient as ever.” This talk will show why — deeply, madly, and truly.

The other two talks already announced are the following, which I previously reported last week:

  • Andrei will be giving an in-depth talk on “BIG: C++ Strategies, Data Structures, and Algorithms Aimed at Scalability.” Briefly, it’s about writing high-performance C++ code for  highly distributed architectures, focusing on translating C++’s strong modeling capabilities directly to great scaling and/or great savings, and finding the right but non-intuitive C++ techniques and data structures to get there.
  • I’ll be giving a brand-new talk on “C++ and the GPU… and Beyond.” I’ll cover the state of the art for using C++ (not just C) for general-purpose computation on graphics processing units (GPGPU). The first half of the talk discusses the most important issues and techniques to consider when using GPUs for high-performance computation, especially where we have to change our traditional advice for doing the same computation on the CPU. The second half focuses on upcoming C++ language and library extensions that bring key abstractions for GPGPU — and in time considerably more — directly into C++.

I hope to see many of you there this August. Last year’s event sold out during the early-bird period, and although we’ve increased the attendance cap this year to make room for more, if you’re interested in coming you may want to register soon to reserve a place.

Keynote at the AMD Fusion Developer Summit

In a couple of months, I’ll be giving a keynote at the AMD Fusion Developer’s Summit, which will be held on June 13-16, 2011, in Bellevue, WA, USA.

Here’s my talk’s description as it appears on the conference website:

AFDS Keynote: “Heterogeneous Parallelism at Microsoft”
Herb Sutter, Microsoft Principal Architect, Native Languages

Parallelism is not just in full bloom, but increasingly in full variety. We know that getting full computational performance out of most machines—nearly all desktops and laptops, most game consoles, and the newest smartphones—already means harnessing local parallel hardware, mainly in the form of multicore CPU processing. This is the commoditization of the supercomputer.

More and more, however, getting that full performance can also mean using gradually ever-more-heterogeneous processing, from local GPGPU and Accelerated Processing Unit (APU) flavors to “often-on” remote parallel computing power in the form of elastic compute clouds. This is the generalization of the heterogeneous cluster in all its NUMA glory, and it’s appearing at all scales from on-die to on-machine to on-cloud.

In this talk, Microsoft’s chief native languages architect shares a vision of what this will mean for native software on Microsoft platforms from servers to devices, and showcases upcoming innovations that bring access to increasingly heterogeneous compute resources — from vector units and multicore, to GPGPU and APU, to elastic cloud — directly into the world’s most popular native languages.

If you’re interested in high performance code for GPUs, APUs, and other high-performance TLAs, I hope to see you there.

Note: This talk is related to, but different from, the GPU talk I’ll be presenting in August at C++ and Beyond 2011 (aka C&B). You can expect the above keynote to be, well, keynote-y… oriented toward software product features and of course AMD’s hardware, with plenty of forward-looking industry vision style material. My August C&B technical talk will be just that, an in-depth performance-oriented and sometimes-gritty technical session that will also mention product-related and hardware-specific stuff but is primarily about heterogeneous hardware, with a more pragmatically focused forward-looking eye.

C++ and Beyond 2011

I’m very much looking forward to C++ and Beyond 2011 this August, again with Scott Meyers and Andrei Alexandrescu. All of my own talks will be brand-new material never given publicly before.

This year’s program will be heavily oriented toward performance (first) and C++0x (second). There are two talks announced so far:

  • Andrei will be giving an in-depth talk on “BIG: C++ Strategies, Data Structures, and Algorithms Aimed at Scalability.” Briefly, it’s about writing high-performance C++ code for  highly distributed architectures, focusing on translating C++’s strong modeling capabilities directly to great scaling and/or great savings, and finding the right but non-intuitive C++ techniques and data structures to get there.
  • I’ll be giving a brand-new talk on “C++ and the GPU… and Beyond.” I’ll cover the state of the art for using C++ (not just C) for general-purpose computation on graphics processing units (GPGPU). The first half of the talk discusses the most important issues and techniques to consider when using GPUs for high-performance computation, especially where we have to change our traditional advice for doing the same computation on the CPU. The second half focuses on upcoming C++ language and library extensions that bring key abstractions for GPGPU — and in time considerably more — directly into C++.

An announcement for a third (also performance-focused) talk should be posted within the week, with more to come as we continue to announce the talk schedule as it firms up.

Registration is now open. I hope many of you will be able to make it.

We Have FDIS! (Trip Report: March 2011 C++ Standards Meeting)

News flash: This afternoon, the ISO C++ committee approved the final technical changes to the C++0x standard. The new International Standard for Programming Language C++ is expected to be published in summer 2011.

The spring 2011 ISO C++ meeting was held on March 21-25 in Madrid, Spain. As previously reported, the goal of this meeting was to finish responding to national body comments on the Final Committee Draft (FCD), and to accept the last set of technical changes and approve a Final Draft International Standard (FDIS) for the final international ballot.

We reached that goal. Indeed, thanks to everyone’s hard work not just at this meeting but at and in between the meetings leading up to Madrid, we were done early enough in the week that we also got to work on resolving a number of lower-priority features and still end a day early on Friday, instead of also working all day Saturday as originally planned. (That said, it wasn’t a holiday — as usual for ISO C++ meetings, pretty much every day you could find roughly half of committee members working long past midnight in technical group sessions on particular issues and updating and reviewing proposed wording changes, then starting up again bright and early the next morning.)

Where are we in the process?

At around 16:00 Madrid time on Friday, the committee voted to approve the FDIS document, to many rounds of applause and thanks to our hosts, our project editor Pete Becker, our subgroup chairs Bjarne Stroustrup, Steve Adamczyk, Alisdair Meredith, Howard Hinnant, Lawrence Crowl, and Hans Boehm, and everyone else who has worked so hard over the last few years to bring us to this point.

The work isn’t quite done yet. The project editor now needs to update the working draft with the changes approved at this meeting, and a review committee of over a dozen volunteers will review it to help make sure those edits were made correctly. The result will be the FDIS draft. Once that happens, which we expect to take about three weeks, we will transmit the FDIS to ITTF in Geneva to kick off the final up/down international ballot which should be complete this summer.

If all goes well, and we expect it will, the International Standard will be approved and published in 2011, henceforth to be known as C++ 2011.

A word about quality

Just like the first time a decade and a half ago, this time we again took longer than we initially thought to produce the second C++ standard. Partly it was because of early ambitious feature scope, but primarily it was in the name of quality.

Perhaps the most heartening thing to me is that this standard is widely considered among committee old-timers as the highest-quality FDIS document we have shipped in the history of WG21, and we believe it to be clearly in superbly better shape than the first standard’s FDIS that we approved in November 1997 for ballot in early 1998. This time, virtually all features have actually been implemented in at least some shipping compilers, and design churn and overall design risk are significantly lower. This is particularly thanks to having shipped a large set of C++0x’s extensions first in the form of the (non-normative) Library Extensions TR (aka Library TR, aka TR1) which encouraged early vendor implementation of its features in a form that the committee could still tweak, even with breaking changes as needed, before incorporating them in an international standard.

Of course, we know there are bugs and as usual we expect to have a tail of Defect Reports (DRs, aka bug fixes and patches) to process over the next few meetings; but the tail is smaller, and many of those most involved expressed clear confidence that it will be far less than the five-year tail we had on the first standard.

But, as Josee Lajoie said so eloquently in Morristown in November 1997, and as Bjarne Stroustrup and others echoed this afternoon: “Hey, we’re done!”

Let me once again express my personal thanks and appreciation to everyone who has contributed in person and electronically to this standard. We couldn’t have done it without you. Thank you, and enjoy the moment!

Looking forward

It’s our tradition to schedule one meeting a year outside the continental United States, and preferably outside North America, because this helps international participation by making it easier for people from all parts of the world to attend. Next year, as we’ve done before, this “un-American” meeting will be the Kona meeting, which is closer for folks in eastern Asia and Australia who may wish to attend.

Here are the planned dates and locations for the remaining 2011 and 2012 ISO C++ standards committee meetings:

  • August 15-19, 2011: Bloomington, IN, USA
  • March, 2012: Kona, HI, USA
  • September, 2012: Portland, OR, USA

Herb

Interview on Channel 9

Over the holidays, Erik Meijer interviewed me on Channel 9. We covered a wide variety of topics, mostly centered on C++ with some straying into C#/Java/Haskell/Clojure/Erlang, but ranging from auto and closures to why (not?) derive future<T> from T, and from what the two most important problems in parallelism are in 2011 to why and how to taste new programming languages regularly. I think it turned out well. Enjoy!

2010: Cyberpunk World

Speaking as a neutral observer with exactly zero opinion on any political question, and not even a cyberpunk reader given that I’ve read about two such novels in my life: Is it just me, or do the last few months’ global news headlines read like they were ghostwritten by Neal Stephenson?

I wonder if we may look back on 2010 as the year it became widely understood that we now live in a cyberpunk world. Many of 2010’s top stories read like sci-fi:

  • Stuxnet: Sovereign nations (apparently) carry out successful attacks on each other with surgically crafted malware — viruses and worms that target specific nuclear facilities, possibly causing more damage and delay to their targets’ weapons programs than might have been achieved with a conventional military strike.
  • Wikileaks: Stateless ‘Net organizations operating outside national laws fight information battles with major governments, up to and including the strongest industrial and military superpowers. The governments react by applying political pressure to powerful multinational corporations to try to force the stateless organizations off the ‘Net and cut off their support and funding, but these efforts succeed only temporarily as the target keeps moving and reappearing.
  • Anonymous: Small vigilante groups of private cybergunners retaliate by (or just latch onto a handy excuse to go) carrying out global attacks on the websites of multinational corporations, inflicting enough damage on Visa and Mastercard to temporarily take them off the ‘Net, while being repelled by cyberfortresses like Amazon and Paypal that have stronger digital defenses. But before we get too confident about Amazon’s strength, remember that this definitely ain’t the biggest attack they’ll ever see, just a 21st-century-cyberwar hors d’oeuvre: Who were these global attackers? About 100 people, many of them teenagers.
  • Assange: Charismatic cyberpersonalities operating principally on the ‘Net live as permanent residents of no nation, and roam the world (until arrested) wherever they can jack in, amid calls for their arrest and/or assassination.
  • Kinect: Your benevolent (you hope) living room game console can see you. Insert obligatory Minority Report UIs no longer sci-fi line here, with optional reference to Nineteen Eighty-Four.
  • Other: Never mind that organized crime has for years now been well-known to be behind much of the phishing, spam, card skimming, and other electronic and ‘Net crimes. Not new to 2010, but seeing a significant uptick in the continued transition from boutique crime to serious organization and spear-phishing targeting specific high-profile organizations including the U.S. military.

Over the coming months and years, it will be interesting to see how multinational corporations and sovereign governments react to what some of them no doubt view as a new stateless — transnational? extranational? supernational? — and therefore global threat to their normal way of doing business.

Trip Report: November 2010 C++ Standards Meeting

The fall 2010 ISO C++ meeting was held on November 8-13 in Batavia, IL, USA. The post-meeting mailing is now live, including meeting minutes and other information.

I attended this meeting virtually, as I was still recovering from some shoulder surgery. Fermilab’s teleconference facilities are excellent — I think it’s safe to say they’re the best I’ve ever used, and it was very helpful for several of us telecommuters to participate actively in the key design discussions below.

Where are we in the process?

For this and the next meeting (Madrid in March), the committee is doing ballot resolution and dealing with national body comments. Because we issued a Final Committee Draft, ISO C++0x can officially no longer add new features. All that we can do is address national body comments, and make any other bug fixes we find.

Things are going well and we are on track to complete the Final Draft International Standard (FDIS) for the C++0x standard after the Madrid meeting in March. If that happens and that ballot succeeds, the C++0x standard will be published in 2011. If it turns out we need another meeting to be able to handle the last of the comment tail, the fallback will be to target FDIS at the following meeting (Indiana in August).

For about five years now we’ve been having three six-day meetings a year, besides smaller unofficial subgroup meetings in person or by teleconference in between official meetings. Because things are going well, we also decided to scale back to two five-day meetings a year starting in 2011, which is what we had after C++98 shipped until work on C++0x began in earnest.

Key design decisions at this meeting

Note: For the first item, I’ll repeat much of the text from the August meeting trip report to make this a standalone post.

Attributes: alignment, noreturn, and virtual control. As reported in the previous trip report, my personal hot button for these past two meetings was that C++0x syntax for override control in particular not look like the following example:

class [[base_check]] Derived : public Base {
public:
  virtual void f [[override]] ();
  virtual double g [[final]] ( int );
  virtual void h [[hiding]] ();
};

The committee has now decided replace these attributes with keywords. The two main options for keywords were:

  • fully reserved words, which can break existing user code that uses the words as variable or type names and so would mean we need to pick uglier names; and
  • contextual keywords as done in C++/CLI, which does not break existing user code and so lets us pick the ideal nice names, but which would be the first contextual keywords in ISO C++ (and there’s always resistance to being the first).

It was decided to follow the latter — contextual keywords pretty much as used in C++/CLI, down to renaming [[hiding]] as new. Here’s the paper with the wording changes, and here’s how the above example now looks:

class Derived explicit : public Base {
public:
  virtual void f () override;
  virtual double g( int ) final;
  virtual void h() new;
};

The other two kinds of attributes that we considered changing to keywords were [[align]] to specify the alignment of a type, and [[noreturn]] to specify that a function never return. The committee confirmed the decision reported as tentative in the previous trip report, namely to change [[align]] to a keyword and leave [[noreturn]] alone.

With these changes, the only two standard attributes are [[noreturn]] and [[carries_dependency]].

noexcept, part 1: Destructor and delete operators noexcept by default. This tentative resolution from Rapperswil was mostly adopted. Briefly, every destructor will be noexcept by default unless a member or base destructor is noexcept(false); you can of course still explicitly override the default and write noexcept(false) on any destructor. This means that the vast majority of classes should be noexcept. The papers containing the exact wording changes are here (destructors) and here (delete operators). For detailed rationale and ranting about why this is a Good Thing, see the previous trip report.

noexcept, part 2: noexcept now partly applied to the standard library. We also passed the first set of papers to apply noexcept to the standard library, including changing functions marked throw() or specified “Throws: Nothing” to be marked noexcept, and removing non-empty exception specifications from the standard library.

Restricting implicit move generation. A hot topic going into this meeting was that move operations could be generated implicitly for an existing type in ways that would be surprising and incorrect (i.e., break the invariants that should hold on all objects of that type). The previous rule was to generate a move constructor and move assignment operator implicitly if the class had no user-declared copy constructor and the move constructor would not be implicitly defined as deleted. Several options were discussed at length, including not generating move implicitly at all. In the end, the decision was that implicit move was both desirable but needed to be generated less aggressively to ensure correctness, and so now the rule is to generate a move constructor and move assignment operator implicitly if the class had no user-declared copy constructor and the move constructor would not be implicitly defined as deleted (same as before) and the class has no user-declared copy or move assignment operator or user-declared destructor. Here’s the paper with the wording changes.

Looking forward

Finally, here are the scheduled dates and locations for next year’s ISO C++ standards committee meetings:

  • March 21-26, 2011: Madrid, Spain
  • August 15-19, 2011: Bloomington, IN, USA

Herb

PDC Languages Panel and (Shortened) Lambdas Talk

At PDC 2010 this week, I participated in a panel and gave one talk. Both are now online for live on-demand viewing.

Note: The talks should work on any browser. They do not require Silverlight. If you get a message that Silverlight is needed, it just made a mistake in auto-detecting your browser (I’m told this happens with Firefox sometimes), so just click on one of the alternate formats and Bob’s your uncle.

Here they are:

1. Languages Panel (update: new link)

I got to participate again this year on a fun panel on programming languages and software development, together with fellow panelists Anders Hejlsberg (creator of Turbo Pascal, Delphi, and C#), Gilad Bracha (of Java and Newspeak fame), and Mark S. Miller (of Ecmascript and E and general security fame). Our esteemed moderator, Erik Meijer, is one of the original designers of LINQ in C# and has contributed heavily to many other languages.

2. Lambdas, Lambdas Everywhere (update: new link)

This is a shortened version of the full lambdas talk I gave at C&B on Wednesday, and will be giving again at C++ and Beyond Encore this December. To get the full talk, come to C&B Encore… but to get a good chunk of it, check out this version online.

Note: Just before the talk, I went around the room to chat with individual attendees, and discovered that a lot of the audience members were C# programmers who didn’t realize this was a C++ talk. Just before we went live, I spoke up to the room and alerted everywhere about that, and nearly everyone stayed anyway, which was nice. But if you wonder why I mentioned C# lambdas a number of times to this audience, that’s why.