Technology

CppCon 2019: C++-20 at 40

Bjarne Stroustrup

  • Introduced b a high school student

  • Stability and evolution
  • “A tour of C++”, 2nd edition
  • Distinguish betwee what’s lega and what’s effective
    • Better tool support, eg C_+ core Guidlines
  • C++: principled and eclectic
  • C++ a general purose programming language for the defn, impl and use of lightweight abstractions
  • “We don’t really like C++ but is it the only thing that works”
  • C++ high level aims
    • Evolutionary (stable, gradual adoption)
    • Make simple things simple
    • Zero-overhead principle
    • Aim high: change the way we design and implement software and we think
  • Key C++ “Rules of thumb”
    • Static type sisteym build-in and user-defined
    • Value and referenc semantics
    • Direct use of machine and operating system resources
      • Layers of abstraction
        • The Onion principle:The more layers you peel off, the more you cry
    • Systematic and generl resource management (RAII)
      • Construct/destructor paris
      • Every resource must have an owner; don’t use built-in pointers (T*) to manage
    • Support composition of software from separatelhy developed parts
      • Modules
    • Support for generic programming
      • write code that works for types tat meet abstract requirements
      • requiremensts are defined as concepts
    • Support fo compile-time programming
      • const_expr
      • Move computaton from run-time to compile-time
    • Support for object-oriented programming
      • Still useful and popular
      • Need reference semantics
      • Don’t need run-time; use static resolution (variant)
      • See
        overloaded

        which do not ake it into c++20

    • Concurrency through libraries supported by intrinsics
      • mutex, RAII
      • atomics
    • C++ is tunable and evolves
      • Always measure
    • Things work in combination
    • Library design is language desing; language design is library design
    • cppreference.com/w/cpp/libs
    • Chrono
    • You have to raise the level abstraction for tools to enforce type and resource-safe C++
    • These rules are about 40 years old
    • C++2o the best approximation of C++’s ideals (so far)
  • The future
    • C++23:
      • Completes C++20
      • Plus: standard modules, library support for coroutines, executors and netowrking
      • Maybe: static reflection, pattern match
  • Questions
    • Something about co_await and threads
    • How to deal with legacy code
      • In new code use modern features
      • Either try and encapsulate
      • Need more tooling
    • What feature most affected c++11:
      • const_expr
      • basic support for concurrent programming
    • What feature most affected c++20:
      • concepts will make generic much simpler, elegant, adn useful
      • modules should improve our compile speeds (5-10 times?). Major advantage is from cleaning up your code.
    • Not pay for things you use. However someone has to pay $ for implementing these features
      • It’s better to put the burden on implementers then users. 50,000 users for 5-10 implementors
    • Are there plans to add features to enforce ownership checks at compile time?
      • Use static enforced coding guideless to enforce “good” coding standards instead of “legal” codes.
    • Cyril from Bloomberg. Would you discourage use of runtime polymorphism?
      • Does someting really need hierarchis and runtime/dynamic types

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.