Dependency Injection in C++from state changing ❑ Find the const/pure functions • Refactor God classes ❑ Functionality clustered and pushed into tiered abstraction layers ❑ Lessen unnecessary dependencies • Refactor fragmented0 码力 | 106 页 | 1.76 MB | 6 月前3
Back to Basics: Exceptionsexceptions result in a call to std::terminate() No stack unwinding No destructors are called Resources are potentially leakedHow Do Exceptions Work 25 void f() { std::string s{ “Some default initializer” exceptions result in a call to std::terminate() No stack unwinding No destructors are called Resources are potentially leakedHow Do Exceptions Work 26 void f() { std::string s{ “Some default initializer” exceptions result in a call to std::terminate() No stack unwinding No destructors are called Resources are potentially leakedHow Do Exceptions Work 27 void f() { std::string s{ “Some default initializer”0 码力 | 111 页 | 4.87 MB | 6 月前3
Better Code: Contractsoperation has no effects. The basic guarantee: if an error occurs, invariants are upheld and no resources leak. 84© 2023 Adobe. All Rights Reserved. Three useful guarantees regarding errors The nothrow operation has no effects. The basic guarantee: if an error occurs, invariants are upheld and no resources leak. void pop_back() pre { size() < 0 } post [old_size = size()] { size() == old_size operation has no effects. The basic guarantee: if an error occurs, invariants are upheld and no resources leak. void pop_back() pre { size() < 0 } post [old_size = size()] { size() == old_size0 码力 | 204 页 | 4.46 MB | 6 月前3
Back to Basics: Move Semanticsan rvalue Move constructor / assignment: One rvalue reference parameter Transfer ownership of resources Leave the source object in a valid state Quick summary29 David Olsen — Back to Basics: Move Semantics Constructor Transfer ownership of resources from existing object to object being constructed Use subojbect’s move constructor when possible Explicit transfer of resources otherwise How to write one79 David to Basics: Move Semantics — CppCon 2020 #includeMove Constructor Transfer ownership of resources from existing object to object being constructed Use subojbect’s move constructor when possible 0 码力 | 142 页 | 1.02 MB | 6 月前3
Cetting Started with C++through libraries Building correct, secure, and safe systems Planning for the future Agenda Resources for learning modern C++ 0501 Obtaining tools for your platform 02 03 04 Code reuse through through libraries Building correct, secure, and safe systems Planning for the future Agenda Resources for learning modern C++ 05Tools for your platform Build & project systems Editors & IDEs through libraries Building correct, secure, and safe systems Planning for the future Agenda Resources for learning modern C++ 0501 Obtaining tools for your platform 02 03 04 Code reuse through0 码力 | 95 页 | 4.71 MB | 6 月前3
Branchless Programming in C++Efficiency and performance ● Understanding the hardware and using it efficiently – Computing resources of a CPU – Pipelining – Branch prediction and hardware loop unrolling ● Conditional code vs use of hardware – use all available resources – at the same time – all the timeBranchless Computing 6 GLOSSARY OF HARDWAREBranchless Computing 7 COMPUTING RESOURCES OF A CPU unsigned long v1[N], v2[N]; Computing 8 COMPUTING RESOURCES OF A CPU unsigned long v1[N], v2[N]; unsigned long a = 0; for (size_t i = 0; i < N; ++i) { a += v1[i]*v2[i]; }Branchless Computing 9 COMPUTING RESOURCES OF A CPU register:0 码力 | 61 页 | 9.08 MB | 6 月前3
Delivering safe C++security violations from bad code in various language (incl. C++) and other causes • Diversion of resources from C++ to other languages • Discouraging people from learning C++ • Massive improvements are safer) styles of use • Except where it is not appropriate • Direct use of system and hardware resources • Need for ultimate efficiency • Implementation of code that cannot be proven safe (e.g., some linked Resource leaks: failing to delete resources (e.g., memory, file handles, and locks) potentially leading to the program grinding to a halt because of lack of available resources. • Concurrency errors: failing0 码力 | 74 页 | 2.72 MB | 6 月前3
Back to Basics: Concurrencyto learn I hope this is a talk that you can revisit in the future and do a deep dive with the resources at the endWhat is Concurrency? And the possible motivation to work concurrently 9Human Psychology Multiple things can happen at once, the order matters, and sometimes tasks have to wait on shared resources. 2. Parallelism Definition: Everything happens at once, instantaneously 18Parallelism vs Concurrency Multiple things can happen at once, the order matters, and sometimes tasks have to wait on shared resources. 2. Parallelism Definition: Everything happens at once, instantaneously 19Parallelism vs Concurrency0 码力 | 141 页 | 6.02 MB | 6 月前3
The Roles of Symmetry And Orthogonality In Designcomplexity and size Adaptable: Remains manageable as system is adapted to new domains Efficient: Resources are spent wiselyCharley Bay - charleyb123 at gmail dot com The Roles of Symmetry And Orthogonality to “work-engine” composed of queues and threads) • Benefits: Greater scaling as threads/workers/resources are made available • Costs: Producer cannot directly monitor work progress (but indirect monitoring handling • Competition for Resources • CPU cache pressures • Cache line false sharing • System calls • File handles • Network traffic • Other OS resources • Other hardware resources Relationships can0 码力 | 151 页 | 3.20 MB | 6 月前3
C++ in the Developing World, Why it Mattersworld” software that has already been written in the language. • It will also touch on tooling and resources for programming on resource constrained systems. Definitions C++ • What is C++? 1• Probably available when the User Needs It) • To Have adequate KNOWLEDGE, to make the most of the computing resources available • To have All of the Above at a COMFORTABLE COST Developing • The process of “Growing Chromebooks, have been deployed in some countries as a solution to low spec, mass deployment of computing resources. • This however comes with the precondition of connectivity. • This solution cannot work in the0 码力 | 8 页 | 177.52 KB | 6 月前3
共 152 条
- 1
- 2
- 3
- 4
- 5
- 6
- 16













