Sei sulla pagina 1di 61

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 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
C++14 libs: cbegin/
greater<>/make_unique
C99 designated
initializers
C++TS? async/await
C++14 libs: std:: user-
defined literals
C++TS concepts lite
unconditional
wave

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:: user-
defined literals
C++TS concepts lite
4Q13
high probability
in CTP
med probability
in CTP
unconditional
wave

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
C++14 libs: cbegin/
greater<>/make_unique
C99 designated
initializers
C++TS? async/await
C++14 libs: std:: user-
defined literals
C++TS concepts lite
4Q13
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
C++11
C++98 + TR1
C++11
C++98
C++98
language library
proxies for size comparisons:
spec #pages, book #pages
proxies for size comparisons:
spec #words
library #types (non-plumbing)
2008 .NET FX + VS Pro Libs
Java SE 7
C++11
language
C# 3.0 (2008)
Java 7 (2011)
2008 .NET FX (only)
C++11
library
2008 .NET FX + VS Pro Libs
Java SE 7
C++11
C# 3.0 (2008)
Java 7 (2011)
2008 .NET FX (only)
C++11
language library
C++11
C# 3.0 (2008)
Java 7 (2011)

?
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 whats listed above will
roughly double the size of the
standard library.
B. Stroustrup, HoPL-III, 2007
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++11


Completed
C++14
CD


sg1
sg8

sg4
3








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
Language: C++

Primary author: Robert Hodgin
Self taught programmer
Sculpture major at RISD
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
Image credit:
Bilby (via Wikipedia)
Addressable text modes: get/set (x,y)
Graphics modes up to 320x192 @ 1.5 colors
#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();
}
60: graphics + input
5%
18%
45%
32%
you tonight
From scratch
Standard C++
openFrameworks
Cinder

ctorre@microsoft.com
This is what I
built from
scratch in an
afternoon
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.
Dont target niche uses. (Example: Sci-eng linear algebra.)
Dont become a platform = fat libs that duplicate native services.
Dont 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.
Dont target niche uses. (Example: Sci-eng linear algebra.)
Dont become a platform = fat libs that duplicate native services.
Dont attempt to define a portable cross-platform library that will
be inferior to a native platform app. (Example: GUI WIMP widgets.)



Message queue, ranges + range algorithms, parallel
algorithms, thread-safe containers, continuations (future.then),
file system, networking/sockets,
REST web services, HTTP, HTML,
JSON,
audio/image/video, databases,




PyPI + apt-get for C++ libs
ad-hoc
de facto
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 weve still never had all three:


Until 2013, the world had never enjoyed even one
of the following, and weve still never had all three:

Multiple consistent (never)
100% (first in 2013)
same year (never)



Multiple consistent
100%
same year
Starting in 12-18mo, this could be the new normal
Observation
We are
rapidly
approaching

Potrebbero piacerti anche