1 / 61

One C++

One C++. Herb Sutter. Themes: Understanding the C++ Tide Organization Momentum Population shift (with just a little code) Trajectory. Agenda. Visual C++ Roadmap Update ISO C++ Update Portable C++ Libraries Update One C++. JUN'13. Conformance roadmap: The road to C++14.

leiko
Download Presentation

One C++

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. One C++ Herb Sutter

  2. Themes: Understanding the C++ TideOrganizationMomentumPopulation shift (with just a little code)Trajectory

  3. Agenda • Visual C++ Roadmap Update • ISO C++ Update • Portable C++ Libraries Update • One C++

  4. JUN'13 Conformance roadmap: The road to C++14

  5. Conformance roadmap: The road to C++14

  6. JUN'13 Conformance roadmap: The road to C++14 wave Post-RTM OOB CTP What we’re currently implementing, roughly in order… some subset in CTP Planned What’s next for full conformance

  7. Conformance roadmap: The road to C++14 wave Post-RTM OOB CTP – 4Q13 What we’re currently implementing, roughly in order… some subset in CTP Planned What’s next for full conformance high probability in CTP unconditional med probability in CTP

  8. Conformance roadmap: The road to C++14 wave Post-RTM OOB CTP – 4Q13 What we’re currently implementing, roughly in order… some subset in CTP Planned What’s next for full conformance unconditional

  9. Agenda • Visual C++ Roadmap Update • ISO C++ Update • Portable C++ Libraries Update • One C++

  10. ISO C++: A Living Language C++98 (major) C++03 (TC, bug fixes only) C++11 (major) C++14 (minor) C++17 (major) You arehere 14 2014++ cadence This ISO C++ revision cycle: faster, more predictable Less monolithic: Delivering concurrent and decoupled library & language extensions C++ is a living language 98 99 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 FileSys TS Library TR1 (aka TS) Performance TR Net TS1 Concepts TS

  11. C++14: Stability • Each round of international comment ballots generates bugs, tweaks, and requests

  12. C++14: Stability • Each round of international comment ballots generates bugs, tweaks, and requests

  13. Agenda • Visual C++ Roadmap Update • ISO C++ Update • Portable C++ Libraries Update • One C++

  14. GN’12 Portable C++ proxies for size comparisons: spec #pages, book #pages language library C++11 C++98 + TR1 C++11 C++98 C++98

  15. 2008 .NET FX + VS Pro Libs Java SE 7 2008 .NET FX (only) GN’12 Portable C++ proxies for size comparisons: spec #words library #types (non-‘plumbing’) language library C++11 Java 7 (2011) C++11 C# 3.0 (2008)

  16. GN’12 Portable C++ 2008 .NET FX + VS Pro Libs language library Java SE 7 2008 .NET FX (only) C++11 Java 7 (2011) C++11 C# 3.0 (2008)

  17. GN’12 Portable C++ ? 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 C++11 Java 7 (2011) C++11 C# 3.0 (2008)

  18. GN’12 Portable C++ Library (PCL) • 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++.

  19. GN’12 Wonderful! But… • … where are we going to find all these libraries? PCL WG21

  20. Portable C++ Libraries

  21. De Jure: The Standard • De jure libraries • std:: • Horizontal • Ship in the box

  22. ChallengeMake the world’s most flexible and efficient library-building language better for building libraries and bundle more broadly useful libraries

  23. Challenge, Part 2‘Who will specify all these libraries? To make it happen, we must involve new people, not just ask for more work from today’s committee members.’– B. Stroustrup, Kona, Feb 6, 2012

  24. ISO C++ (WG21) attendance Completed C++14CD • Thanks to all the volunteers! Completed C++11

  25. … … 3 … … sg4 … … … …

  26. WG21 Organization WG21 – Full Committee Library WG Core WG Evolution WG Lib Evolution WG SG4 Networking SG5 Tx. Memory SG3 Filesystem SG7 Reflection SG6 Numerics SG2 Modules SG11 Databases SG1 Conc. & Parall. SG8 Concepts SG9 Ranges SG12 U. Behavior SG10 Feature Test Lang Extension Lib building Lib composability Base Libs Domain Libs   - - -  - - -    - - - - -  -  -  - - -  

  27. Update: SG1 July Meeting, Santa Clara • Concurrency TS1 (2014?) • All of: • std::future Extensions: then, wait_any, wait_all • Executors • Resumable Functions:await(with futures) • + If ready (else TS2): • Counters • Queues • Concurrent containers: concurrent_vector, unordered associative containers • Latches and barriers • upgrade_lock? Parallelism TS1 At least one of: • Parallel algorithms (e.g., Parallel STL) • Data-based parallelism • Task-based parallelism + If ready (else TS2) • MapReduce • Pipelines? Bringing state-of-the-artconcurrency and parallelism to Standard C++

  28. WG21 Organization WG21 – Full Committee Library WG Core WG Evolution WG Lib Evolution WG SG4 Networking SG5 Tx. Memory SG3 Filesystem SG7 Reflection SG6 Numerics SG2 Modules SG11 Databases SG1 Conc. & Parall. SG8 Concepts SG9 Ranges SG12 U. Behavior SG10 Feature Test (SG13) 2D Graphics Thanks, Tom et al.! Lang Extension Lib building Lib composability Base Libs Domain Libs   - - -  - - -    - - - - -  -  -  - - -   

  29. Reality checkNobody knows what “most” C++ programmers do. — Bjarne Stroustrup

  30. Q: Which language would you recommend for creative graphics apps written by non-CS majors? Planetary Primary author: Robert HodginSelf taught programmerSculpture major at RISD Language: C++

  31. Q: Which language would you recommend for creative graphics apps written by non-CS majors? Did you know? C++ library openFrameworks is widely used in teaching art & design • Incl. prestigious schools like Parsons School for Design C++ “creative coding” library Cinder awarded ad industry’s highest honor • June 2013: Cannes Lions Festival, Innovation Grand Prix C++ app Planetary acquired by Smithsonian • August 2013: The museum’s first-ever curation/preservation of code

  32. From the trenches • The advertising and design industries have really embraced C++ in recent years for a new generation of interactive projects. • I think that’s largely because in our work, a piece of software’s performance often marks the difference between a user’s experience feeling ordinary and feeling magical. • This [2013] has been an excellent year for C++’s visibility in the art and design worlds… • — Andrew Bell

  33. Who did/do I want it for? GN’13Stroustrup • 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

  34. How Easy Is C++, Really? • // First thing Scott said: • cout << “Is that on a scale of 10 to 20?\n”

  35. How Easy Is C++, Really? 15 LOC Example • #include <iostream> #include <algorithm> #include <vector> using namespace std; • int main() { • vector<int> v;inti = 0; • cout<< "Please enter some numbers: "; • while( cin >> i )v.push_back(i); • sort( begin(v), end(v) ); • cout<< "Here are those numbers, sorted:"; • for( auto& e : v )cout<< ' ' << e; • cout<< endl;}

  36. Reality checkC++ is aboutexploiting the machineStandard C++ doesn’t exploit my 1979 Atari Addressable text modes: get/set (x,y) Graphics modes up to 320x192 @ 1.5 colors Image credit: Bilby (via Wikipedia)

  37. How Easy Is C++, Really? 18 LOC Example • #include "cinder/app/AppBasic.h"#include "cinder/dx/dx.h"#include <vector>using namespace ci;using namespace ci::app; • class MyApp: public AppBasic {std::vector<Vec2f> points;public: void mouseDrag( MouseEvente ) { 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(); }}; • CINDER_APP_BASIC( MyApp, RendererDx )

  38. How Easy Is C++, Really? 200 LOC Example Time: One afternoon • From scratch, incl. installing & learning Cinder, and incl. 1h lost on a GL bug Line count (nonempty) 9: #include / using 34: data 86: game logic 60: graphics + input • Including board display, player animation, powerup color flashing and warning transitions, … 5% 18% 45% 32%

  39. Q: How many people here are developers?

  40. Q2: How many of you brought a compiler?

  41. Q3: … and used it already? Gauntlet: What creative graphics app can you build tonight? • Use a favorite compiler and target OS • From scratch = empty project • Using only Standard C++ plus either openFrameworks(openframeworks.cc) or Cinder(libcinder.org; for DX, search “cinder site:msdn.com”) Email your name and screenshot(s)/video to ctorre@microsoft.com Tell us about it for 2 min tomorrow This is what I built from scratch in an afternoon

  42. Slide courtesy Rick Barraza

  43. Slide courtesy Rick Barraza

  44. Slide courtesy Rick Barraza

  45. Slide courtesy Rick Barraza

  46. Slide courtesy Rick Barraza

  47. Slide courtesy Rick Barraza

  48. Just Getting Organized: 2D Graphics • “Draft” proposed initial scope • Initial thinking, subject to change: • Modern C++11/14 API for 2D + text.Audio and 3D separate, but combinable (e.g., 2D as HUD over 3D). Flexible, not a “game engine.” Thin, not a new platform or Big-F Framework. • Immediate mode + sprites/particles/input. Later: retained mode. • Included-but-optional default graphics loop. • native_handle hook. Implementable on at least DX & OpenGL + native_handle gateway to platform-specific code. • Asset loading/construction hook.Included-but-optional default “load asset from file” + simple way to plug into user’s asset system (maybe ‘load from memory’ suffices?). Major C++ graphics libraries Inviting participation from: • openFrameworks • Cinder • SFML • LibSDL • Qt • DirectXTK • Cocos2D • Graphucks • Hieroglyph • …

  49. GN’12 PCL Scope • 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.)

  50. GN’12 PCL Scope • 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.) • 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.

More Related