December 2012

C++ Optimization Manuals -- Agner Fog

[Ed.: Many thanks to reader Bartosz Bielecki for directing our attention to a good resource for all the performance tweak-heads out there. You know who you are.]

Agner Fog's C++ Optimization Manuals

submitted by Bartosz Bielecki

Agner Fog's site is one of the most important pages related to software optimization (also for the C++). You will find following guides there:

  • C++ optimization,
  • assembly optimization,
  • CPU instructions choice,
  • C++ calling conventions,
  • and various other links/tools.

If you have not been there, it is high time you did it!

Continue reading ...

Value Semantics and Concepts-Based Polymorphism -- Sean Parent

This past year at C++Now, Sean Parent gave a talk about Value Types that blew the room away. It will deepen your understanding of the design of the STL and change the way you think about and write code. He'll also show you some lean-and-mean image-processing demos that will drop your jaw. This is why we do C++.

Value Semantics and Concepts-Based Polymorphism

by Sean Parent

Sean will further develop the Value Semantics and Concepts-based Polymorphism concepts covered in his keynote, "Now What? A vignette in 3 parts."

Note: The audio is soft. Turn your volume up. The slides, the Keynote presentation, and the source code can be found in C++Now's GitHub repo here.

Watch the video...

 

Embarcadero C++ Builder XE3 released: Highly-conforming Clang-based C++11 compiler

On Monday in their webcast talk following the Bjarne Stroustrup interview, Embarcadero announced C++Builder XE3 -- a highly-conforming Clang-based C++11 compiler that enables targeting Windows, OS X, and soon iOS and Android from a single modern C++11 code base, including leveraging the latest platform features such as Windows 8's WinRT and OS X Mountain Lion's Retina display support.

From the product announcement:

C++Builder XE3 delivers the best of both worlds – a highly-compliant C++11 64-bit Windows toolchain with an agile development solution. Now you can use the latest C++ features and libraries while you speed your development process with C++Builder’s visual development environment.

With C++Builder XE3, developers can use Embarcadero C++ standard extensions to provide an agile coding experience with rapid prototyping and reusable software components, and a fully integrated two-way visual development environment so you can deliver your applications to market faster.

  • New 64-bit Windows compiler based on a multi-device targeting architecture
  • C++98, C++TR1, and C++11 language standards
  • ANSI C, ISO C, C99, and C11 language standards
  • Dinkumware STL 5.3 and Boost 1.5
  • CLANG compatible
  • Agile C++ language extensions
  • Cross-compilation to multiple Windows and Mac OS X platforms (iOS and Android coming in 2013)

Continue reading...

 

Using C++11 to Speed Up Your Qt 5 Programs -- Marc Mutz

Last month's Qt DeveloperDays Europe videos are now available, including this one showing continued rapid adoption of C++11.

Using C++11 to Speed Up Your Qt 5 Programs (PDF slides)

Marc Mutz

Qt 5 comes with much-improved support for C++11. This talk will teach you techniques that you can use to make your applications use less memory or execute faster when compiled with a C++11 compiler. The focus is on techniques that will not break compatibility with C++98 compilers. After a look at the present state of C++11 support in Qt 5.0, the talk closes with a look at what we can expect in Qt 5.1.

From the summary slide "C++11 @ QT 5.0":

  • constexpr added to many types
  • move semantics added to a few types
  • initializer_list added to most types
  • new few N-ary ctors marked explicit, N >= 2
  • = delete used almost ubiquitously
  • noexcept added in a few central places

Systematic Error Handling in C++ -- Andrei Alexandrescu

Channel 9 has just posted a video of Andrei Alexandrescu’s "Systematic Error Handling in C++11" presented at C++ and Beyond 2012 last summer in Asheville, NC. This is a great 90-minute talk with useful insights and techniques for programming in general and programming in C++11 in particular.

Systematic Error Handling in C++11

Andrei Alexandrescu

Writing code that is resilient upon errors (API failures, exceptions, invalid memory access, and more) has always been a pain point in all languages. This being still largely an unsolved (and actually rather loosely-defined) problem, C++11 makes no claim of having solved it. However, C++11 is a more expressive language, and as always more expressive features can be put to good use toward devising better error-safe idioms and libraries.

This talk is a thorough visit through error resilience and how to achieve it in C++11. After a working definition, we go through a number of approaches and techniques, starting from the simplest and going all the way to file systems, storage with different performance and error profiles (think HDD vs. RAID vs. Flash vs. NAS), and more. As always, scaling up from in-process to inter-process to cross-machine to cross-datacenter entails different notions of correctness and resilience and different ways of achieving such.

To quote a classic, "one more thing"! An old acquaintance -- ScopeGuard -- will be present, with the note that ScopeGuard11 is much better (and much faster) than its former self.

Registration for C++Now 2013 Is Now Open

[Ed. Your friendly neighborhood isocpp.org editor can highly recommend this event, formerly known as BoostCon. From the announcement:]

Registration for C++Now 2013 Is Now Open!

The seventh annual C++Now Conference (formerly BoostCon) will be held at the Aspen Center for Physics in Aspen, Colorado, May 12th to 17th, 2013.

"We are thrilled to announce the second annual C++Now conference, the whole-language edition of BoostCon covering all the coolest topics in C++," said Dave Abrahams, Conference Co-Chair. "In 2012, we broadened the conference scope by adding a third track and offering more C++11 coverage than any other event, and the community responded with an unprecedented number of registrations. In 2013, we are going to build on that success with foundational sessions integrating what we've all learned about using C++11 during the past year, while continuing the exploration of cutting-edge topics that BoostCon attendees have come to expect."

Read the full announcement for the registration deadlines and a special call for volunteers, who get their registration fees waived.

Continue reading...

Use CRTP for Polymorphic Chaining -- Marco Arena

Use CRTP for Polymorphic Chaining

by Marco Arena

 

This suggested video reminded me another use of CRTP I described some months ago. It was about how to support method chaining when inheritance is involved.

Consider this simple scenario:

struct Printer
{
   Printer(ostream& stream) : m_stream(stream) {}

   template<typename T>
   Printer& println(T&& message)
   {
      cout << message << endl;
      return *this;
   }

protected:
   ostream& m_stream;
};

struct CoutPrinter : public Printer
{
   CoutPrinter() : Printer(cout) {}

   CoutPrinter& color(Color c) 
   {
      // change console color
      return *this;
   }
}

//...

CoutPrinter printer;
printer.color(red).println("Hello").color( // OOPS

println("Hello") returns a Printer& and not a CoutPrinter&, so color is no longer available.

In this post I wrote a very simple approach based on CRTP to maintain the chaining relationship when inheritance is involved. I also propose a complicated-at-first-sight way to avoid duplication employing a bit of metaprogramming.

Continue reading...

Library WG split: Library and Library Evolution

The Committee page has been updated to reflect an organizational change: WG21 has decided to split the Library working group into a core “Library” group (LWG) and a forward-looking “Library Evolution” group (LEWG), following the model of how the language side is split between “core” and “evolution.”

Summary:

  • Library (LWG) is responsible for standard library quality and will handle non-evolutionary DR/issue processing and the wording/fine-tuning of new library facilities. Alisdair Meredith will continue to chair this group.
  • Library Evolution (LEWG) is responsible for processing and refining new proposals. Like EWG on the language side, Library Evolution may choose to handle the proposals directly or else recommend spinning up a Study Group. When a library-only SG is ready to progress, LEWG will determine whether to proceed, and if so the target ship vehicle (IS or TS). We are very grateful that Beman Dawes has agreed to serve as an interim “bridge” chair for a year or two, to apply his long experience with LWG to get Library Evolution set up and moving in the right direction, and to find and train a longer-term chair – so part of Beman’s job immediately will be to start to replace himself.

Thank you to Beman for his volunteering to lead Library Evolution, and to Alisdair for his continued excellent efforts leading Library! It’s hard work, and much appreciated.

Reminder: Bjarne Stroustrup live interview webcast on Monday

Reminder: On Monday morning in California (find your local time), the free online CodeRage 7 conference will kick off with a special inverview with Bjarne Stroustrup.

Note that registration is free but required -- you need to register in order to get information on how to access the live GoToWebcast event.

SPECIAL SESSION: A C++ Conversation with Bjarne Stroustrup

Bjarne Stroustrup and David Intersimone
 

Monday, December 10th - 8:00am - 8:45am PST (find your local time)

Bjarne Stroustrup will discuss the ISO C++11 standard, new language features, how C++11 builds on C++’s strengths, application portability, and C++’s ubiquitous presence in the markets.

 

Session Full?

We anticipate a very large audience for this special session.  In the event that the conference GoToWebinar session becomes full during this session, you may use the following link to listen to the audio stream:

AUDIO ONLY OVERFLOW - https://www3.gotomeeting.com/register/692238398