Webinar Recording: A Tour of Modern C++

The recording of our July 2nd webinar, A Tour of Modern C++, is now available.

Webinar recording

by Anastasia Kazakova

In this webinar, Dmitri Nesteruk shows the latest language additions introduced in C++11 and also talks a little bit about some of the forthcoming features in C++14 and 17.

Demo project can be found on GitHub.

Agenda:

  • 01:02 - Uniform initialization, initializer lists.
  • 09:47 - Auto & decltype.
  • 17:42 - Override & final.
  • 22:03 - Lambdas.
  • 28:10 - Strongly typed enumerations.
  • 30:43 - Range-based 'for' loops.
  • 34:05 - Static asserts.
  • 37:33 - Type traits.
  • 38:53 - Variadic templates.
  • 45:04 - Smart pointers.
  • 54:47 - rvalue references.
  • 01:01:08 - Q&A session.

 

Listen to the recording and read the answers to some of the questions asked during the webinar in our blog post.

Easier To Use, And More Expressive--Tony DaSilva

Here is some reasonning of the new standard:

Easier To Use, And More Expressive

by Tony DaSilva

From the article:

One of the goals for each evolutionary increment in C++ is to decrease the probability of an average programmer from making mistakes by supplanting “old style” features/idioms with new, easier to use, and more expressive alternatives. The following code sample attempts to show an example of this evolution from C++98/03 to C++11 to C++14...

CppCast Episode 23: Game Dev and Low Latency with Nicolas Guillemot

Episode 23 of CppCast the only podcast for C++ developers by C++ devlopers. In this episode Rob and Jason are joined by Nicolas Guillemot to discuss the ongoing work of the GameDev and Low Latency C++ Study Group.

CppCast Episode 23: Game Dev and Low Latency with Nicolas Guillemot

by Rob Irving and Jason Turner

About the interviewee:

Nicolas Guillemot started studying C++ and OpenGL to make games, and fell in love with them. He enjoys participating in game jams, and has had the opportunity to work in some game development studios: Inlight Entertainment, and Electronic Arts. He is currently taking a break from finishing a bachelor's in software engineering to work at Intel, doing mostly graphics-related work to help game developers take advantage of Intel GPU features.

CppCon 2015 Program Highlights, 4 of N

The CppCon 2015 conference program has been posted for the upcoming September conference. We’ve received requests that the program continue to be posted in “bite-sized” posts, a few sessions at a time, to make the 100+ sessions easier to absorb, so here is another set of talks. This series of posts will conclude once the entire conference program has been posted in this way.

 

The C++ possess another language inside it: the template language. It is useful for a lot of things, from writting less code to compile time computations or checks, but can lengthen compile time too. To master it is not easy.

The following interrelated CppCon 2015 talks tackle these issues and more (part 2).

In this post:

  • Compile-time tools supporting generic programming in C++
  • C++ metaprogramming: a paradigm shift
  • Pruning Error Messages From Your C++ Template Code
  • C++ Metaprogramming: Journey from simple to insanity and back
  • boo{stache} exposed : the inner-workings of a generic template engine

 

Compile-time tools supporting generic programming in C++

Generic programming is a programming paradigm which makes it possible to build highly extensible and efficient libraries. In C++ it can be implemented using templates, therefore developers and users of generic libraries need to understand how the compiler works with templates. The details are important when the code using a library instantiates different templates (or specialisations), or the same templates but with different arguments as expected. Fixing such bugs can lead to difficult debugging sessions. These are not bugs in the program's runtime behaviour. These are bugs in the program's compile-time behaviour and therefore different tools are needed to find them. Tools providing insight into what happens during the compilation process are needed.

Template metaprogrammers have been pushing the limits of what is possible using templates. The way they use templates is usually more complex than what generic libraries need. Recently a number of advanced tools supporting template metaprogrammers have been built. REPL shells, debuggers, profilers are available to make it possible to see what happens during compilation.

This talk presents how these tools can be used and be useful for the developers and users of generic libraries. Insight into what happens inside the compiler can be extremely useful to understand why the code compiles slowly, behaves the way it does or to debug errors in code using generic libraries.


C++ metaprogramming: a paradigm shift

Most people think metaprogramming is hard. It isn't; we just didn't have the right tools for it. This talk will present a new way of metaprogramming using the same syntax as that of normal C++. It will show how the runtime and the compile-time boundaries can be crossed almost seamlessly. It will show how compilation times can be reduced without sacrificing expressiveness. It will introduce Hana [1], a newly accepted Boost library using cutting edge features of the language in a creative way to solve the problem of metaprogramming for good.

[1]: http://github.com/ldionne/hana


Pruning Error Messages From Your C++ Template Code

Many template libraries are regarded with ambivalent feelings by developers: On the one hand, such libraries can offer wonderful functionality. On the other hand, they are dreaded for the sheer amount of error messages spilled out by the compiler when there is even a small bug in the developer's code. This talk will demonstrate several techniques to drastically reduce the amount of compiler output in case of errors (with real-life examples, of course).


C++ Metaprogramming: Journey from simple to insanity and back

Part I: Introduction to template metaprogramming. Template metaprogramming is a variant of generic programming, a technique that uses C++ template mechanism to perform computations at compilation time, usually to generate, from a single description, executable code that depends on the properties of the data types. It can be viewed as “programming with types”. In this example-driven class we start with the overview of the metaprogramming tools (everything you wanted to know about template specializations but were afraid to ask). We will apply these tools to simple examples, such as: how to sort a sequence in order of increasing values, unless it’s a sequence of pointers, in which case we want the values of what they point to. Part II: Advanced techniques and practical applications. Simple examples of metaprogramming are fun and useful, but once you master them you start chafing at the limitations. This is C++, where we don’t suffer limitations gladly. We therefore move on to the more advanced techniques, including SFINAE, and the appropriately more advanced examples. The journey takes us back to the beginning: after all, when sorting a sequence of values vs a sequence of pointers, you don’t really care whether the pointer is smart or dumb. What you really want to know is whether “*p” compiles or not. What you really need is an “if_compiles” metaprogramming function.


boo{stache} exposed : the inner-workings of a generic template engine

Template engines are commonly found generating web pages, customer reports, or even source code. They take a source template and data model as input and generate some desired output.

Boostache was started as the Library in a Week challenge from CppNow'14 with initial support for Mustache.

Today Boostache supports multiple template formats and adapts automagically at compile time to user defined data models. Many of the techniques utilized in Boostache are the same that Ciere has employed in custom IDL compilers, Domain Specific Language systems, compilers, and runtimes.

This talk will briefly introduce Boostache and then delve into the internal architecture and design of the library. We will explore some implementation details of the parser, compiler, virtual machine, and generic data model infrastructure with the goal to expose useful techniques and patterns from this C++11 code base that can be used in your own libraries and applications.

Messaging and signaling in C++

The 7th part of my series on writing applications in C++ using Qt and boost:

Messaging and Signaling in C++

by Jens Weller

From the article:

This time it is about how to notify one part of our application that something has happened somewhere else. I will start with Qt, as it brings with signals and slots a mechanism to do exactly that. But, as I have the goal not to use Qt mainly in the UI Layer, I will also look on how to notify other parts of the application, when things are changing.

CppCon 2015 hotels filling up

cppcon-031.PNGIf you're registered for CppCon (or going to be), make sure you book your hotel soon. If you leave booking till the week before the conference it's likely you'll have to stay someplace a few miles away because downtown Bellevue is a popular spot in September and all hotels within reasonable walking distance of CppCon are expected to be fully booked by the time of the event.

Last year's CppCon was well attended, and registration is stronger this year. Three of the four CppCon hotel room blocks are now sold out. The final CppCon negotiated room rate block expires on Monday at noon PST.

The announcement:

Hotel Room Shortage Predicted

Book Now!

Our contacts at the official conference hotels are predicting that, like last year, all hotel rooms in Bellevue will be booked.

Currently three of our four hotel blocks are full. The Marriott still has some rooms that we’ve reserved for attendees. Originally they had agreed to hold these rooms (at a conference discounted rate) until this Friday, but they’ve agree to extend the deadline to Monday (August 24th) at noon (west coast time).

We strongly encourage anyone planning to attend this year’s conference to book your room right away.

ะก++ Hints

Within the scope of this project, we publish 1 recommendation/tip on C and C++ programming every day, these tips containing concentrated information on techniques of using the C/C++ language in various situations, and including examples of incorrect and correct use from more than 200 open-source projects we have scanned.

C++ Hints

by PVS-Studio Team

From the hint:

Although the code is neat and easy-to-read, it didn't prevent the developers from overlooking the error. You can't stay focused when reading code like that because all you see is just similarly looking blocks and you can't help just quickly scanning through them. These similar blocks have most likely resulted from the programmer's desire to optimize the code as much as possible. He or she just "unrolled the loop" manually. I don't think it was a good idea in this case.