CppCon 2015 Using Spirit X3 to Write Parsers--Michael Caisse

Have you registered for CppCon 2016 in September? Don’t delay – Early Bird registration is open now.

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

Using Spirit X3 to Write Parsers

by Michael Caisse

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

Parsing is a common problem in many domains. The complexity of using a library often pushes developers to ad-hoc solutions utilizing std::string manipulations, regular expressions, or nested if/switch statements. Most “quick hack” implementations are unmaintainable.

Spirit provides a Domain Specific Embedded Language (DSEL) that allows grammars to be described in a natural and declarative manner just like writing PEG or EBNF directly in your C++ code. X3 is the third major release of the Spirit library and improves both compile and run times while simplifying the much of the library.

In this tutorial session you will be introduced to Spirit X3, attribute parsing, and variety of tips to writing efficient and maintainable parsers. We will build a JSON parser during the session to illustrate techniques and usage of the library. This session is applicable toward anyone needing to parse data.

Exploring C++17 and Beyond

From NDC Oslo 2016:

Exploring C++17 and Beyond

by Mark Isaacson

About the video:

"[This is] a talk about playing with things that don't exist yet. The fun part, is that almost all of it is possible in C++ today. You don't need to wait. You can play with things like std::string_view and get the performance, safety/correctness, and self-documentation benefits today. You can write your own version of constexpr if that works just fine in C++11, lowering the barrier to entry for template branching and design by introspection. The one topic I talked about that you can't just try at home today is operator dot. Operator dot makes for some wonderful brain exercises. In this talk, I use it to implement contracts, specifically postconditions, in C++. In my talk from last year, I used it to let you mix in arbitrary code into any instance of any type. For anyone wondering what features are coming to C++ and when, I open the talk with a specific breakdown of what's new in C++17 and C++20. I also spend a moment talking about why things like concepts and modules didn't make it into C++17."

DynaMix - A new take on polymorphism in C++

DynaMix (Dynamic Mixins) is a new take on polymorphism. It lets the user compose and modify types at run time in C++

DynaMix released

From the release:

The library is a means to create a project's architecture rather than achieve its purpose. It focuses on maximal performance and minimal memory overhead.

DynaMix is great for the software architecture of systems with very complex objects including, but not limited to:

  • Games (especially role-playing ones or strategies)
  • CAD systems
  • Enterprise systems
  • UI libraries
     

Quick Q: Why doesn't std::queue::pop return value?

Quick A: To guarantee exception safety and for performance.

Some time ago on SO:

Why doesn't std::queue::pop return value?

So, whats the difference, pop function could have done the same thing.

It could indeed have done the same thing. The reason it didn't, is because a pop that returned the popped element is unsafe in the presence of exceptions (having to return by value and thus creating a copy).

Consider this scenario (with a naive/made up pop implementation, to ilustrate my point):

template<class T>
class queue {
    T* elements;
    std::size_t top_position;
    // stuff here
    T pop()
    {
        auto x = elements[top_position];
        // TODO: call destructor for elements[top_position] here
        --top_position;  // alter queue state here
        return x;        // calls T(const T&) which may throw
    }

If the copy constructor of T throws on return, you have already altered the state of the queue (top_position in my naive implementation) and the element is removed from the queue (and not returned). For all intents and purposes (no matter how you catch the exception in client code) the element at the top of the queue is lost.

This implementation is also inefficient in the case when you do not need the popped value (i.e. it creates a copy of the element that nobody will use).

This can be implemented safely and efficiently, with two separate operations (void pop and const T& front()).

CppCon 2015 Modern User Interfaces for C++--Milian Wolff

Have you registered for CppCon 2016 in September? Don’t delay – Early Bird registration is open now.

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

Modern User Interfaces for C++

by Milian Wolff

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

The C++ language evolved significantly in the recent past, and so did many frameworks and libraries in the big ecosystem surrounding it.

For twenty years now, Qt is being used on a multitude of platforms to create native looking, compelling graphical user interfaces.

It offers C++ libraries and tools for building desktop, mobile and embedded applications. Qt gives engineers APIs for developing using two dimensional controls, integrating 3D using OpenGL, embedding web content, as well as a new declarative domain-specific language called QML, which is extensible using C++. Qt is also much more than a UI toolkit and provides a multitude of helper libraries for various use-cases, such as localization, database access, XML and JSON parsing and much more.

During this talk, I will give an introduction to Qt and present its capabilities in how it can be utilized to write modern UIs using C++, both in 2D as well as 3D. Additionally, I will show how some of its features, like the integrated web engine or QML, can be leveraged to go beyond C++. While at it, I hope to clear up some outdated misconceptions about Qt and its relationship to standard C++ and the STL as well as Boost and other libraries.

Finally, I will present the KDE Frameworks, an open source collection of high quality, cross platform Qt libraries that are being used by the KDE Software Collection. KDE frameworks are to Qt as Boost is to the STL. Recent development makes it simpler than ever to use these libraries in external applications.

CppCon Early Bird registration closes on Friday

cppcon-082.PNGThis is it! Four days left -- CppCon 2016 Early Bird registration closes on Friday.

As a warmup, the optional pre-conference classes run Saturday and Sunday, and then CppCon 2016 Week kicks off on Monday morning with an opening keynote by Bjarne Stroustrup on the latest in the C++ world, followed by more than 100 of the best C++ talks of 2016, lightning talks, panels, exhibitors where you can try live products and find one-on-one helpdesks to get popular C++ compilers' developers to help you with your questions, and more.

And of course, a full week of around-the-clock interaction with fellow attendees from across industries and disciplines, making CppCon the best learning and networking opportunity for C++ developers in a relaxed and inviting festival atmosphere.

To see what others have had to say about CppCon, check out the attendee video, featuring a soundtrack of original music written and performed by the CppCon house band. And check out the video archive of 2014 and 2015 talks on YouTube and on Channel 9.

CppCon is "the" C++ event of the year. Early Bird registration closes on Friday. If you haven't registered yet, register today!

How to Convince Your Boss to Send You to CPPCon (at company expense!)

The CPPcon conference is tremendously educational and interesting. The venue in Bellevue Washington is very, very nice and agreeable.  Attendees get to rub elbows with well known people in the business.  For  A C++ programmer to be standing in the registration queue next to Bjarne Stroustrup, Sean Parent, (or myself -- lol) is actually a physical thrill -- like meeting a rock star. Add in emotional disputes about arcane topics that no one else understands, good music, good beer, free snacks and coffee it's better than a vacation -- which is basically is -- and paid by the company without impacting your wife's vacation time. It might even enhance your career! And's all free because the company is paying for it!

But course you can't you can't get all these benefits unless you can get your company to send you!  So here's my suggestion on how to get you company to pay for it. 

  • Don't spend too much time on the above explanation of what the conference is really like.
  • Promise to post each evening a report on the sessions you've attended and your review of them.  At least some of the sessions you've attended will be relevant to issues currently confronting your team.  Such an internal posting will permit your team members to ask more questions while you've still got access to the other conference attendees and speakers.  This could spark new ideas on making better/faster progress on your products. 
  • Pitch conference as a place to send people to get new ideas useful in solving the companies or boss's problems. Of course this presumes that a) your company actually has problems and b) that people realise this.
  • You'll be able to "scout" content that is particularly relevant to you current challenges. Since all the content is later available on video, other team members and the company will benefit from it with out having to wade through hours other stuff.  So your team mates will be able to watch video on company time! This will somewhat ameliorate the resent they'll have about you going the conference while they stay at the office lashed to the hamster wheel.

Hope this works for you and hope to see a record turnout.

CppCast Episode 61: Oulu Trip Report with Herb Sutter

Episode 61 of CppCast the only podcast for C++ developers by C++ developers. In this episode Rob and Jason are joined by Herb Sutter, chair of the ISO C++ standards committee, to discuss the latest progress on C++17 made at the Oulu ISO Standards meeting.

CppCast Episode 61: Oulu Trip Report with Herb Sutter

by Rob Irving and Jason Turner

About the interviewee:

Herb Sutter is a leading authority on software development. He is the best selling author of several books including Exceptional C++ and C++ Coding Standards, as well as hundreds of technical papers and articles, including the essay “The Free Lunch Is Over” which coined the term “concurrency revolution” and its recent sequel “Welcome to the Jungle” on the end of Moore’s Law and the turn to mainstream heterogeneous supercomputing from the cloud to ‘smartphones.’

Herb has served for a decade as chair of the ISO C++ standards committee, and is a software architect at Microsoft where he has led the language extensions design of C++/CLI, C++/CX, C++ AMP, and other technologies.