C++14: Through the Looking Glass

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.
No video block=(
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!
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;
}
@Steve: Yes, but the point was lots of people don't bother to do that.
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?
Really amazing talk Chandler. I'm going to using Clang and these utilities after this talk. Thank you :)
clang on Windows!
Whole lot of awesome.
C
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?
He is using a program call tmux
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.