Back To Basics: The Rule of FiveAgenda ● Background ● Core Guidelines ● What is the Rule of Five ● Compiler provided functions ● What is the Rule of Zero 3Copyright © 2023 Andre Kostur C++ is a net> C++ Core Guidelines 6Copyright © 2023 Andre Kostur Guideline C.21 is “The Rule of Five” 7Copyright © 2023 Andre Kostur Simple String 8Copyright © 2023 Andre nullptr; return *this; } // … char * data_; }; 19Copyright © 2023 Andre Kostur The Rule of Five C.21: “If you define or =delete any copy, move, or destructor function, define or =delete 0 码力 | 42 页 | 623.10 KB | 6 月前3
Cache-Friendly Design in Robot Path Planning158 wr) ==131579== LLd misses: 3,336,167 ( 2,266,653 rd + 1,069,514 wr) ==131579== D1 miss rate: 7.9% ( 9.6% + 0.7% ) ==131579== LLd miss rate: 158 wr) ==131579== LLd misses: 3,336,167 ( 2,266,653 rd + 1,069,514 wr) ==131579== D1 miss rate: 7.9% ( 9.6% + 0.7% ) ==131579== LLd miss rate: ==131579== LLd misses: 3,336,167 ( 2,266,653 rd + 1,069,514 wr) 12 ==131579== D1 miss rate: 7.9% ( 9.6% + 0.7% ) 13 ==131579== LLd miss rate:0 码力 | 216 页 | 10.68 MB | 6 月前3
Back to Basics: The structure of a Programwrite • The phases of translation • Declarations, definitions, and linkage • The one-definition rule (ODR) • Storage duration • ABIs and name-mangling • Linking and loading CppCon 2020 - The Structure use Build Tools Source Code Tools Dependency Packages Dependency Tools ld, ld.bfd, ld.gold, lld, link.exe, …Copyright © 2020 Bob Steagall K E W B C O M P U T I N G C++ Programming Ecosystem – Building and z have no linkageCopyright © 2020 Bob Steagall K E W B C O M P U T I N G The One-Definition Rule (ODR) • A given translation unit can contain at most one definition of any: • variable • function0 码力 | 64 页 | 390.34 KB | 6 月前3
Shared Librarieswith – • --no-allow-shlib-undefined (on the exe) • Operates recursively on ld, not on gold/lld. • -z defs (on the shlib) • --no-undefined (on the shlib) 19 bar foo exe lib1 lib2 lib3 lib4 Mach-O and PE/COFF have many problems but this may be a place where they got right.” Fangrui Song, LLD maintainer https://maskray.me/blog/2021-06-13-dependency-related-linker-options 21Position Independent thegreenplace.net/2011/11/03/position-independent-code-pic-in-shared-libraries/ • Fangrui Song, LLVM/LLD contributor: • https://maskray.me/blog/ • SystemV ABI spec and mailing list • https://groups.google0 码力 | 69 页 | 1.40 MB | 6 月前3
The Servo Book - 0.0.1setshortname' to create a short name for any c omponents of this path that have spaces. (on Windows) = note: lld-link: error: undefined symbol: __std_search_1 >>> referenced by D:\a\mozjs\mozjs\mozjs-sys\mozjs\i usb , which requires the user has permissions to access the device. It's recommended to add a udev rule to allow hdc to access the corresponding device without needing to run hdc as root. This stackoverflow hdc . Run lsusb and check the vendor id of your device, and then create the corresponding udev rule. Please note that your user should be a member of the group you specify with GROUP="xxx" . Depending0 码力 | 107 页 | 2.48 MB | 1 天前3
Shared Libraries and Where To Find Themof the systemThe linker [ld] ● Program is typically called ld ○ other implementations: ld.gold, lld, mold ● On Linux, typically invoked by gcc itself via the collect2 tool g++ my_program.cpp -o the collect2 invocation with -v ● GNU Linker is typically the default, there’s others: ○ gold, lld, mold ○ They may have slightly different behaviorsThe linker [ld] - search procedure (cont’d)The dynamic0 码力 | 94 页 | 6.49 MB | 6 月前3
Julia 1.11.4unit sequences. This convention allows to treat any byte sequence as a String. In such situations a rule is that when parsing a sequence of code units from left to right characters are formed by the longest prefixes thereof are treated as a single invalid character rather than multiple invalid characters. This rule may be best explained with an example: julia> s = "\xc0\xa0\xe2\x88\xe2|" "\xc0\xa0\xe2\x88\xe2|" local, the value (or lack thereof) of the global x is unaffected by calling greet. The hard scope rule doesn't care whether a global named x exists or not: assignment to x in a hard scope is local (unless0 码力 | 2007 页 | 6.73 MB | 4 月前3
Julia 1.11.5 Documentationunit sequences. This convention allows to treat any byte sequence as a String. In such situations a rule is that when parsing a sequence of code units from left to right characters are formed by the longest prefixes thereof are treated as a single invalid character rather than multiple invalid characters. This rule may be best explained with an example: julia> s = "\xc0\xa0\xe2\x88\xe2|" "\xc0\xa0\xe2\x88\xe2|" local, the value (or lack thereof) of the global x is unaffected by calling greet. The hard scope rule doesn't care whether a global named x exists or not: assignment to x in a hard scope is local (unless0 码力 | 2007 页 | 6.73 MB | 4 月前3
Julia 1.11.6 Release Notesunit sequences. This convention allows to treat any byte sequence as a String. In such situations a rule is that when parsing a sequence of code units from left to right characters are formed by the longest prefixes thereof are treated as a single invalid character rather than multiple invalid characters. This rule may be best explained with an example: julia> s = "\xc0\xa0\xe2\x88\xe2|" "\xc0\xa0\xe2\x88\xe2|" local, the value (or lack thereof) of the global x is unaffected by calling greet. The hard scope rule doesn't care whether a global named x exists or not: assignment to x in a hard scope is local (unless0 码力 | 2007 页 | 6.73 MB | 4 月前3
julia 1.13.0 DEVunit sequences. This convention allows to treat any byte sequence as a String. In such situations a rule is that when parsing a sequence of code units from left to right characters are formed by the longest prefixes thereof are treated as a single invalid character rather than multiple invalid characters. This rule may be best explained with an example: julia> s = "\xc0\xa0\xe2\x88\xe2|" "\xc0\xa0\xe2\x88\xe2|" local, the value (or lack thereof) of the global x is unaffected by calling greet. The hard scope rule doesn't care whether a global named x exists or not: assignment to x in a hard scope is local (unless0 码力 | 2058 页 | 7.45 MB | 4 月前3
共 187 条
- 1
- 2
- 3
- 4
- 5
- 6
- 19













