Noexcept: Enabling Testing of Contract ChecksNoexcept? Enabling Testing of Contract Checks Pablo Halpern and Timur Doumler This work by Pablo Halpern & Timur Doumler is licensed under a Creative Commons Attribution 4.0 International License contracts require good enforcement. • Contract checks help catch bugs early in the process. • Observation: Good enforcement requires good oversight. • Contract checks should themselves be tested. 4-Oct-23 are for • The importance of writing contracts and checking them at run time • How to unit test contract-checking annotations (CCAs) • How noexcept interacts with unit testing of CCAs. We will go over0 码力 | 90 页 | 1.38 MB | 6 月前3
Back to Basics: Smart PointersSmart Pointers Back to Basics Rainer Grimm Training, Coaching, and Technology Consulting www.ModernesCpp.netSmart Pointer A First Overview std::unique_ptr – Exclusive Ownership std::shared_ptr – Concurrency Function Arguments and Return ValuesOverview 4 Smart pointers automatically manage the lifetime of its resource. ▪ Smart Pointers ▪ Allocate und deallocate their resource in the constructor management with reference counting ▪ Are C++ answer to garbage collection ▪ Release the resource if the smart pointer goes out of scope ▪ Are available in four versions raii.cppOverview Name C++ Standard0 码力 | 30 页 | 625.43 KB | 6 月前3
Modern C++ Tutorial: C++11/14/17/20 On the Fly. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 Chapter 05 Smart Pointers and Memory Management 57 5.1 RAII and Reference Counting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 Contract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . list by itself 4. Expression capture This section needs to understand the rvalue references and smart pointers that will be men- tioned later. The value captures and reference captures mentioned above0 码力 | 92 页 | 1.79 MB | 1 年前3
Hiding Your Implementation Details is Not So Simpleinterface, even if they are not defined in the contract. - With a sufficient number of users of an API, it does not matter what you promise in the contract: all observable behaviors of your system will the required functionality92 Hiding your Implementation Details, Amir Kirsh @ CppCon, 2024 Hiding Smart Pointers and Hierarchies// we want the following code: Expression* e = new Sum ( new Exp(new Number(3) Details, Amir Kirsh @ CppCon, 2024 Why do we use new and delete to begin with? Shouldn’t we use smart pointers? 🤔 Non-symmetric calls to new and delete// what is bothering you with the code below? auto0 码力 | 145 页 | 2.45 MB | 6 月前3
Performance Engineering: Being Friendly to Your Hardwareimplement a SW contract • They do not correspond to the actual execution • Conversion of control flow to a variant of data flow • Really complex • Some operations end here • Can a smart compiler help registers • L/S vs R/M • Flags • Operand count • Destructive destination • Spilling strategy • ISA as a contract 102Vectorization? • The logic of a scalar algorithm applied to a multitude of separate sets . HN H... H2 H1 H2 SN S... S2 S1 Keys 100 (6 + 94) 100 100 5+ 106Why bother? Compiler is smart, one just needs to specify a correct command-line option, no? 107 For vertical operations that0 码力 | 111 页 | 2.23 MB | 6 月前3
Exceptions Under the SpotlightINBAL LEVIWHO AM I? • AC++ enthusiast. • An embedded software engineer at Solar Edge working on smart home. • One of the organizers of CoreCpp conference and user group. • A Member of WG21. • One of that the cleanup process is now part of the language. • By using “setjmp”, “longjmp” we break the contract between the user and the language. (*) • (*) MSVC supports different behavior – e.g. calling DTORs0 码力 | 53 页 | 2.82 MB | 6 月前3
Back To Basics Functionsthis? ● Again we pass-by-reference to avoid a copy ○ The ‘const’ part is a ‘security’ (i.e. contract) that ensures that whatever data we are passing into that function will not be mutated (i.e. change uct options); ● Another ○ void myFunction(OptionsStruct* options); ○ Pass in as a pointer (or smart pointer) to ensure we’re always just passing in an ‘8-byte’ address (on a 64-bit architecture).0 码力 | 123 页 | 7.26 MB | 6 月前3
Rethinking Task Based Concurrency and Parallelism for Low Latency C++MSufSortWhat is the Alternative?Thread Thread Thread Back Front Work Contracts (Overview): ● A Work Contract Group contains: ○ An array of Work Contracts (each with their own logic and, if needed, data, queue not compete for the same Work Contract (task). Alternative: Work Contracts Work Contract Group Work Contract (Logic) Work Contract Work Contract (Logic) Work Contract Data Data Data Data Data Data = number of nodes) Alternative: Work Contracts Work Contract Group Work Contract (Logic) Work Contract Work Contract (Logic) Work Contract Data Data Data Data Data Data Execute Logic(Data) Execute0 码力 | 142 页 | 2.80 MB | 6 月前3
Contracts for C++precondition assertion post (w: w.index() == i); // postcondition assertion Proposal: add contract assertions to C++4 Copyright (c) Timur Doumler | @timur_audio | https://timur.audio post (w: w.index() == i); // postcondition assertion Proposal: add contract assertions to C++ Function contract assertions5 Copyright (c) Timur Doumler | @timur_audio | https://timur assertion { auto* db = getDatabase(); contract_assert (db != nullptr); // assertion statement return db->retrieveWidget (i); } Proposal: add contract assertions to C++6 Copyright (c) Timur Doumler0 码力 | 181 页 | 4.44 MB | 6 月前3
Better Code: Contracts2023 Adobe. All Rights Reserved. Top of the tower 7 © 2023 Adobe. All Rights Reserved.What's in a contract? 8© 2023 Adobe. All Rights Reserved. Hoare Logic | Preconditions and Postconditions 9 Tony of the loop inside Qhas is" j <~ mAhas= i~d(j,A)© 2023 Adobe. All Rights Reserved. Design by Contract | Bertrand Meyer “…a software system is viewed as a set of communicating components whose interaction to Design by Contract™ https://www.eiffel.com/values/design-by-contract/introduction/ 11 Bertrand Meyer© 2023 Adobe. All Rights Reserved. Innovation 1: Each component has a contract 1212 {x > 00 码力 | 204 页 | 4.46 MB | 6 月前3
共 69 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
相关搜索词













