6. The Classic Age
(1989-1999)
Mainstream:
Wide usage
standardization
7. The Dark Age
(1999-2009)
Coffee-based languages domination:
Productivity over Efficiency
People over Hardware
8. Let’s compare them all
Efficiency Flexibility Abstraction Productivity
C
Efficient high-level + + Non-goal Non-goal
portable code
C++
C + efficient + + + Non-goal
abstraction
Java/C#
Productivity At the expence of At the expense of + +
11. C++ Values
Never compromise on performance and control.
Efficient abstraction (e.g., inlining by default)
Flexibility to express exactly what you need (e.g., specialization)
Exact control over memory layout (e.g., stack/member allocation)
Determinism and ordering WYSIWYG (e.g., stack/member lifetime)
Deeply believe in trust and zero overhead.
“Leave no room for a language lower than C++” other than asm
“Zero overhead” / “Don’t pay for what you don’t use”
“Trust the programmer” ( pitfalls! still give usability, guard rails)
“Always provide a way to open the hood and get down to the metal”
12. Priorities
C++ says:
“Provide default-on guard rails and programmer productivity too,
but never at the expense of performance and control.”
Coffee-based languages say:
“Provide performance and control too, but never at the expense
of always-on guard rails and programmer productivity.”
23. The Renaissance
(2009-2019)
Return of the King:
C++11
Productivity tools
24. Developer survey
Q: How long has your current application been in development? (N=387)
25. C++11
Corollary: Lots of what people “know” about C++ is no longer true.
Changes to coding style/idioms/guidance.
That’s why it feels new. Style/idioms/guidance define a language.
Features that significantly change style/idioms/guidance include:
35. Taste of C++11
string flip( string s ) {
program is guaranteed to
reverse( begin(s), end(s) );
allocate only three strings
return translate_to_french( move(s) );
}
high compute / low latency
int main() {
vector<future<string>> v;
v.push_back( async([]{ return flip(" ,olleH"); }) );
v.push_back( async([]{ return flip( ".gnaL"); }) );
v.push_back( async([]{ return flip("n!TXEN"); }) );
for( auto& e : v ) {
cout << e.get(); Bonjour, Langue.SUIVANTE!
}
}
36. Summary
Modern C++ is clean, safe, and fast.
Strong abstraction: Type-safe OO and generic code for modeling power, without
sacrificing control and efficiency.
Full control over code and memory: You can always express what you want to do. You
can always control memory and data layout exactly.
Pay-as-you-go efficiency: No mandatory overheads.
“The going word at Facebook is that ‘reasonably written C++ code just runs fast,’
which underscores the enormous effort spent at optimizing PHP and Java code.
Paradoxically, C++ code is more difficult to write than in other languages, but efficient
code is a lot easier.” – Andrei Alexandrescu
37. The Future
(2019-????)
Here be dragons:
End of Moore