The Care and Feeding of C++’s Dragons

Sign in to queue

Description

Last year I described C++ as bearing the cautionary label ‘Here Be Dragons.’ And yet we’re all still writing C++ because it is the best programming language for the problems we face. In turn, we need a strategy to deal with the “dragons” that reside in large C++ code bases. The Dragon Book (my old compiler textbook) taught about a collection of tools to address the complexity of compiler design, and while our challenge is somewhat different, the approach remains the same. When a mere mortal programmer ventures forth to battle the complexity of large software systems in C++, they’re going to need some really good tools to help them. At Google, we’ve been building up a platform of such tools. I will introduce the platform and toolset, and show how to use them to write fast and correct C++ code, quickly and correctly.

I will also give a peek into the future of the next generation of tools we’re working on and some of the really interesting changes to C++ that are coming in the next few years to help both programmers and these tools be ever more effective.

 

Download:

Source Code

Day:

2

Code:

010

Embed

Download

Download this episode

Download:

The Discussion

  • User profile image
    OleJak

    No video block=(

  • User profile image
    vittoriorom​eo

    Thank you Chandler for this amazing talk, and thanks to everyone who works on Clang. LLVM is my favorite toolchain, and the sanitizers saved my butt countless times! Big Smile

  • User profile image
    Steve

    int sum(const std::vector<int> &numbers) {
    int result = 0;
    for (std::vector<int>::const_iterator it = numbers.begin();
    it != numbers.end(); ++it) {
    result += *it;
    }
    return result;
    }

    Instead of the range-based for fix to help the compiler optimizer with 'numbers.end()'
    for (const auto &number : numbers) {
    result += number;
    }

    As an alternative could this also fix the problem?
    int sum(const std::vector<int> &numbers) {
    int result = 0;
    std::vector<int>::const_iterator it_end = numbers.end();
    for (std::vector<int>::const_iterator it = numbers.begin();
    it != it_end; ++it) {
    result += *it;
    }
    return result;
    }

  • User profile image
    Ben Hanson

    @Steve: Yes, but the point was lots of people don't bother to do that.

  • User profile image
    tomkirbygre​en

    I would love to know Chandler's recommendation for a 'Clang based' experimental sandpit. Even if it is Linux based. Any chance of getting a brief coding environment description from Chandler?

  • User profile image
    trandatnh

    Really amazing talk Chandler. I'm going to using Clang and these utilities after this talk. Thank you :)

  • User profile image
    Charles

    clang on Windows! Smiley

    Whole lot of awesome.

    C

  • User profile image
    Mads Ravn

    This might be an off-topic question, but how is he able to travel the output of his programs with his cursor like he is in an editor?

  • User profile image
    Kris

    He is using a program call tmux

  • User profile image
    Alexander Chertov

    Would be useful if you could run dynamic analysis alongside a debugger: break into debugger on invalid memory access. Just easier to understand the conditions under which the problem happens. Visual C++ has something like that and it's super useful.

Add Your 2 Cents