Modern C++ Tutorial: C++11/14/17/20 On the Flydirection of modern C++ programming. Although it does not appear as much as C++11, it contains a large number of small and beautiful languages and features (such as structured binding), and the appearance You can find the book here. All the code is organized by chapter, the folder name is the chapter number. Exercises There are few exercises At the end of each chapter of the book. It is for testing whether chapter. You can find the possible answer to the problem from here. The folder name is the chapter number. Chapter 01: Towards Modern C++ Compilation Environment: This book will use clang++ as the only0 码力 | 92 页 | 1.79 MB | 1 年前3
C++ Exceptions for Smaller FirmwareReturn mismatch 27 /// @returns false if this failed! bool io_expander_level(std::uint8_t p_pin_number, bool p_high_voltage) { // Implementation details... } void some_output_pin::level(bool p_high_voltage) cost of a check per call ○ N = number of checked function calls 86My Hypothesis ● Cost of using result types: S(N) = aN ○ a = average cost of a check per call ○ N = number of checked function calls ● ● Cost of using exception: S(M) = bM + E ○ b = average cost of exception metadata ○ M = number of non-leaf functions ○ E = cost of exception machinery (libunwind, etc) ○ NOTE: this is grossly simplified0 码力 | 237 页 | 6.74 MB | 6 月前3
Exceptionally Bad: The Story on the Misuse of Exceptions and How to Do Betterthe function / exception block. Exceptions can leave the function at any time potentially resulting in a leak Need to ensure cleanup before exiting Pattern : Exception block catches the exception, releases leaving the function / exception block. Exceptions can leave the function at any time resulting in a leak Cleanup resides in catch block with rethrow Pattern : Exception block catches the exception, releases real information is (usually) in the message/data contained within. Pattern : For a single try block, many exception catch handlers doing the same thing OR a single catch handler for the parent class0 码力 | 85 页 | 2.32 MB | 6 月前3
C++20: An (Almost) Complete Overview• 13:30Concurrency Changes35 Atomic Smart Pointers Is shared_ptr thread safe? Yes: control block manipulation thread safe guarantees object is deleted exactly once No: accessing pointer not thread coordination Latches A thread coordination point Threads block at a latch point, until a given number of threads reach the latch point, at which point all threads are allowed to Library Barriers A sequence of phases In each phase a number of threads block until the requested number of threads arrive at the barrier, then a phase completion callback is 0 码力 | 85 页 | 512.18 KB | 6 月前3
Conan 2.0 Documentationmanagement, it can create and reuse any number of different binaries (for different config- urations like architectures, compiler versions, etc.) for any number of different versions of a package, using build the binaries from sources, etc. One package “conanfile.py” recipe can generate any arbitrary number of binaries, one for each different platform and configuration: operating system, architecture, compiler will trigger it) Furthermore the default versioning scheme in Conan has been generalized to any number of digits and letters, as opposed to the official “semver” that uses just 3 fields. 2.9 compatibility0 码力 | 652 页 | 4.00 MB | 1 年前3
Dependency Injection in C++out the pure functions • Having too many dependencies in a class / functional block ❑ Impractical to pass large number of Dependencies in constructor / function methodbool execute(DB&, Com&, FileLdr& out the pure functions • Having too many dependencies in a class / functional block ❑ Impractical to pass large number of Dependencies in constructor / method • Classes (hierarchies) packed with huge out the pure functions • Having too many dependencies in a class / functional block ❑ Impractical to pass large number of Dependencies in constructor / method • Classes (hierarchies) packed with huge0 码力 | 106 页 | 1.76 MB | 6 月前3
What's Eating my RAM?allocate.Memory Leaks Memory leak fixed. 😕 What else?Fragmentation You try to allocate a big block and you can't, even though you appear to have enough memory free Source: PixabayFragmentation in-use allocations: 31 650 352 Total free space: 212 704 720 Largest allocable block: 63 248 External Fragmentation = 0.9997How to estimate Fragmentation? mallinfo(3) in-use allocations: 30 316 416 Total free space: 2 975 872 Largest allocable block: 120 928 External Fragmentation = 0.9593 mallinfo(3) mallinfo service A: Total bytes0 码力 | 88 页 | 3.49 MB | 6 月前3
Conan 2.10 Documentationmanagement, it can create and reuse any number of different binaries (for different config- urations like architectures, compiler versions, etc.) for any number of different versions of a package, using build the binaries from sources, etc. One package “conanfile.py” recipe can generate any arbitrary number of binaries, one for each different platform and configuration: operating system, architecture, compiler will trigger it) Furthermore the default versioning scheme in Conan has been generalized to any number of digits and letters, as opposed to the official “semver” that uses just 3 fields. 2.9 compatibility0 码力 | 803 页 | 5.02 MB | 10 月前3
Conan 2.6 Documentationmanagement, it can create and reuse any number of different binaries (for different config- urations like architectures, compiler versions, etc.) for any number of different versions of a package, using build the binaries from sources, etc. One package “conanfile.py” recipe can generate any arbitrary number of binaries, one for each different platform and configuration: operating system, architecture, compiler will trigger it) Furthermore the default versioning scheme in Conan has been generalized to any number of digits and letters, as opposed to the official “semver” that uses just 3 fields. 2.9 compatibility0 码力 | 777 页 | 4.91 MB | 10 月前3
Conan 2.9 Documentationmanagement, it can create and reuse any number of different binaries (for different config- urations like architectures, compiler versions, etc.) for any number of different versions of a package, using build the binaries from sources, etc. One package “conanfile.py” recipe can generate any arbitrary number of binaries, one for each different platform and configuration: operating system, architecture, compiler will trigger it) Furthermore the default versioning scheme in Conan has been generalized to any number of digits and letters, as opposed to the official “semver” that uses just 3 fields. 2.9 compatibility0 码力 | 795 页 | 4.99 MB | 10 月前3
共 261 条
- 1
- 2
- 3
- 4
- 5
- 6
- 27













