Themes: Understanding the C++ Tide (with just a little code) Visual C++ Roadmap Update.

Download Report

Transcript Themes: Understanding the C++ Tide (with just a little code) Visual C++ Roadmap Update.

Themes: Understanding the C++ Tide
(with just a little code)
Visual C++ Roadmap Update
Shipped in June
C++14 libs: type aliases
C99 variable decls
C99 _Bool
C99 compound literals
C++14 libs: cbegin/
greater<>/make_unique
C99 designated
initializers
A preview update
will be available
this month
C++14 libs: type aliases
C99 variable decls
C99 _Bool
C99 compound literals
C++14 libs: cbegin/
greater<>/make_unique
C99 designated
initializers
wave
A preview update
will be available
this month
incl. C++98
C++14 libs: cbegin/
greater<>/make_unique
C11
C++14 libs: type aliases
C++14 generalized
lambda capture
C++98 two-phase
lookup
C99 variable decls
C99 _Bool
C++14 auto function
return type deduction
C++14 generalized
constexpr
C99 compound literals
C++14 generic
lambdas
C++14 decltype(auto)
C++14 dyn. arrays
C++14 var templates
C99 designated
initializers
C++TS? async/await
C++14 libs: std:: userdefined literals
C++TS concepts lite
wave
– 4Q13
high probability
in CTP
unconditional
med probability
in CTP
incl. C++98
C11
C++14 generalized
lambda capture
C++98 two-phase
lookup
C++14 auto function
return type deduction
C++14 generalized
constexpr
C++14 generic
lambdas
C++14 decltype(auto)
C++14 dyn. arrays
C++14 var templates
C++TS? async/await
C++14 libs: std:: userdefined literals
C++TS concepts lite
wave
– 4Q13
unconditional
C++14 libs: cbegin/
greater<>/make_unique
incl. C++98
C11
C++14 libs: type aliases
C++14 generalized
lambda capture
C++98 two-phase
lookup
C99 variable decls
C99 _Bool
C++14 auto function
return type deduction
C++14 generalized
constexpr
C99 compound literals
C++14 generic
lambdas
C++14 decltype(auto)
C++14 dyn. arrays
C++14 var templates
C99 designated
initializers
C++TS? async/await
C++14 libs: std:: userdefined literals
C++TS concepts lite
Visual C++ Roadmap Update
ISO C++ Update
2014++ cadence
This ISO C++ revision cycle:
faster, more predictable
Less monolithic: Delivering concurrent and
decoupled library & language extensions
C++ is a living language
Visual C++ Roadmap Update
ISO C++ Update
Portable C++ Libraries Update
proxies for size comparisons:
spec #pages, book #pages
language
library
C++11
C++11
C++98
C++98 + TR1
C++98
proxies for size comparisons:
spec #words
library #types (non-‘plumbing’)
language
Java 7 (2011)
library
C# 3.0 (2008)
C++11
C++11
2008 .NET FX + VS Pro Libs
language
library
Java SE 7
2008 .NET FX (only)
Java 7 (2011)
C# 3.0 (2008)
C++11
C++11
library
“All in all, this [C++0x and post-C++0x
library wish lists] … is not quite the
‘ambitious and opportunistic’ policy
that I had hoped for in 2001 (§8).
However, people who scream for
more (such as me) should note
that even what’s listed above will
roughly double the size of the
standard library.”
– B. Stroustrup, HoPL-III, 2007
Java 7 (2011)
?
C# 3.0 (2008)
C++11
C++11

Goals:






Large set of useful and current libraries.
Available on all major platforms.
Shipped with and supported by C++ implementations.
And composable, using consistent types.
Minimum: De facto availability as part of all major compiler products.
Ideal: De jure inclusion in Standard C++.

… where are we going to find all these libraries?
WG21
ad-hoc
de facto
de jure
ad-hoc
de facto
de jure
Challenge
better for building
bundle more
Challenge, Part 2
new people
Completed
C++14
CD
Completed
C++11
…
…
sg8
…
3
sg1
…
…
sg4
…
…
…
…
Lang Extension
Lib building
Lib composability
Base Libs
Domain Libs


-


-



-

-






All of:
• std::future Extensions:
then, wait_any, wait_all
• Executors
• Resumable Functions:
await (with futures)
At least one of:
• Parallel algorithms (e.g., Parallel STL)
• Data-based parallelism
• Task-based parallelism
Bringing state-of-the-art
concurrency and parallelism
to Standard C++
Lang Extension
Lib building
Lib composability
Base Libs
Domain Libs


-


-



-

-






Reality check
Planetary
Primary author: Robert Hodgin
Self taught programmer
Sculpture major at RISD
Language: C++
openFrameworks
Parsons
Cinder
Cannes
Planetary
Smithsonian
The advertising and design industries have really embraced C++
performance often marks the difference
feeling magical
Who did/do I want it for?
• Primary concerns
–
–
–
–
Systems programming
Embedded systems
Resource constrained systems
Large systems
• Experts
– “C++ is expert friendly”
• Novices
– C++ Is not just expert friendly
Stroustrup - Essence - Going Naive'13
33
// First thing Scott said:
cout << “Is
that on a scale of 10 to 20?\n”
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
while( cin >> i )
v.push_back(i);
sort( begin(v), end(v) );
for( auto& e : v )
cout << ' ' << e;
Reality check
exploiting the machine
1979 Atari
Addressable text modes: get/set (x,y)
Graphics modes up to 320x192 @ 1.5 colors
Image credit:
Bilby (via Wikipedia)
#include "cinder/app/AppBasic.h"
#include "cinder/dx/dx.h"
#include <vector>
using namespace ci;
using namespace ci::app;
void mouseDrag( MouseEvent e )
{ points.push_back(e.getPos()); }
void draw() {
dx::clear( Color( 0.1f, 0.1f, 0.15f ) );
dx::color( 1.0f, 0.5f, 0.25f );
dx::begin( GL_LINE_STRIP );
for( auto& e : points )
dx::vertex(e);
dx::end();
}
5%
18%
45%
32%
60: graphics + input
you
This is what I
built from
scratch in an
afternoon
tonight
• From scratch
Standard C++
openFrameworks
Cinder
[email protected]
Slide courtesy Rick Barraza
Slide courtesy Rick Barraza
Slide courtesy Rick Barraza
Slide courtesy Rick Barraza
Slide courtesy Rick Barraza
Slide courtesy Rick Barraza
• Modern C++11/14 API for 2D + text.
• Immediate mode + sprites/particles/input.
• Included-but-optional default graphics loop.
• native_handle hook.
• Asset loading/construction hook.


Do focus on pure libraries.
Do focus on common modern tasks with state-of-the-art existing
practice.





Lower-level: Message queue, ranges + range algorithms, parallel
algorithms, thread-safe containers, continuations (future.then),
async I/O, file system, networking/sockets, serialization.
Higher-level: REST web services, sensor fusion, HTTP, HTML,
XML/XSLT, JSON, persistence, settings/preferences, compression,
cryptography, audio/image/video, databases, SMS messaging.
Don’t target niche uses. (Example: Sci-eng linear algebra.)
Don’t become a platform = fat libs that duplicate native services.
Don’t attempt to define a “portable cross-platform” library that will
be inferior to a native platform app. (Example: GUI WIMP widgets.)


Do focus on pure libraries.
Do focus on common modern tasks with state-of-the-art existing
practice.





Lower-level: Message queue, ranges + range algorithms, parallel
algorithms, thread-safe containers, continuations (future.then),
async I/O, file system, networking/sockets, serialization.
Higher-level: REST web services, sensor fusion, HTTP, HTML,
XML/XSLT, JSON, persistence, settings/preferences, compression,
cryptography, audio/image/video, databases, SMS messaging.
Don’t target niche uses. (Example: Sci-eng linear algebra.)
Don’t become a platform = fat libs that duplicate native services.
Don’t attempt to define a “portable cross-platform” library that will
be inferior to a native platform app. (Example: GUI WIMP widgets.)
ad-hoc
de facto
“PyPI + apt-get” for C++ libs
de jure
Visual C++ Roadmap Update
ISO C++ Update
Portable C++ Libraries Update
One C++
Observation
“One C++”
for(;;) ++x;
first convergence
C++98: 5 years* (2003, EDG + Dinkumware)
C++11: 2 years (2013, Clang)
C++14: 0 years (2014, probably multiple)
2014-15: Multiple C++14 complete implementations
Until 2013, the world had never enjoyed even one
of the following, and we’ve still never had all three:
Until 2013, the world had never enjoyed even one
of the following, and we’ve still never had all three:
Multiple consistent
100%
same year
(never)
(first in 2013)
(never)
Multiple consistent
100%
same year
Starting in 12-18mo, this could be the new normal
Observation
We are
rapidly
approaching