Neighborhoods Banding Together: Reasoning Globally about ProgramsTruth of a Procedure”😎 😈 😎 😎 😈 😎 😎 Caller 🤠 😈 🤠 🤠 😈 🤠 🤠 Called😎 😎 😎 😈 😎 🤠 😈 🤠 🤠 🤠 😎 Caller + 🤠 Called😎 😈 😎 😎 😈 😎 😎 Caller 🤠 😈 🤠 🤠 😈 🤠 🤠 Called😎 😎 😎 😎 😈 😎 🤠 😈 🤠 🤠 🤠 🤠 😎 😎 🤠 😎 Caller + 🤠 CalledOne Definition Rule Most named entities used in a program must be defined. Some may be defined only once (e.g., non-inline functions). pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. B: Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius, turpis0 码力 | 49 页 | 1.03 MB | 6 月前3
Making Libraries Consumable for Non-C++ Developerslater.What assumptions are being made? void get_size(size_t dev, long* size); Non-C/C++ language. Caller of get_size(). C/C++ binary. Provides get_size(). gcc and clang, sizeof(long) == sizeof(size_t) used here? push ... call data_t get_data_from(unsigned int) add esp, 4 add eax, edx Caller cleanup (cdecl) push ... call data_t get_data_from(unsigned int) add eax, edx Callee get_data_from() member function returns in caller provided memory. This is often unexpected but occurs using the MSVC compiler for x86 with stdcall (callee cleanup) or cdecl (caller cleanup). For non-MSVC, data_t0 码力 | 29 页 | 1.21 MB | 6 月前3
Combining Co-Routines and Functions into a Job SystemThread + Job System + I/O Threads No blocking wait! Instead • Schedule a continuation • End/suspend caller Main thread Main thread P CD CD CD CD CR CR CR CR CR P I I I I I UI N I/O or Render not have a main or render thread. It‘s all jobs with one worker thread per core.‘‘ Axel Gneiting, ID Software, March 21 2020Helmut Hlavacs – Combining Co-Routines and Functions into a Job System - CppCon struct Function{}: std::function, thread, type and id for logging • Tags • Coroutines of type Coro • Thread, type and id with operator() • std::tuple and std::vector containing an 0 码力 | 39 页 | 1.23 MB | 6 月前3
Exceptions Under the SpotlightThrowingFunction __cxa_allocate_exception called Allocating Exceptions: 64B // Returning static &buf to the caller MyException: SomeExc CTOR // Exception constructed __cxa_throw called Exiting... // just exits foo Param1 foo Param2 return address Caller’s RBP foo’s locals bar’s param1 RBP – Frame Pointer RSP – Stack Pointer (top of stack) return address Caller’s RBP bar’s locals int bar(int i) { return return address Caller’s RBP foo’s locals int bar(int i) { // throw() return i; } int foo(int i, int j) { // throw() return bar(i); } int main() { foo(1, 1); } exception id exception handler0 码力 | 53 页 | 2.82 MB | 6 月前3
Embracing an Adversarial Mindset for Cpp Security_CLFS_LOG_BLOCK_HEADER { UCHAR MajorVersion; UCHAR MinorVersion; UCHAR Usn; CLFS_CLIENT_ID ClientId; USHORT TotalSectorCount; USHORT ValidSectorCount; ULONG Padding; ULONG Checksum; typedef struct _CLFS_BASE_RECORD_HEADER { CLFS_METADATA_RECORD_HEADER hdrBaseRecord; CLFS_LOG_ID cidLog; ULONGLONG rgClientSymTbl[CLIENT_SYMTBL_SIZE]; ULONGLONG rgContainerSymTbl[CONTAINER_SYMTBL_SIZE]; ULONGLONG rgSecuritySymTbl[SHARED_SECURITY_SYMTBL_SIZE]; ULONG cNextContainer; CLFS_CLIENT_ID cNextClient; ULONG cFreeContainers; ULONG cActiveContainers; ULONG cbFreeContainers;0 码力 | 92 页 | 3.67 MB | 6 月前3
Back to Basics: Move Semantics*。 With rvalue references you can provide move semantics "”Rvalue references bind to rvalues =- Caller no longer needs the value = May steal but keep valid include1declares std: :move first),lastfc.last),valfc-val) { Parameterehasno move samantcs unless marked with move () again (he caller no longer needs bat we might need muitipl ) Cust (Custs5 c) aoexcepE Jimove constructor : Jpolymorphic base class with virtual functions Protected: std: :string id Jo support move semantics for id declare move functions public: Virtual void Print() const virtual -Person() 0 码力 | 23 页 | 1020.10 KB | 6 月前3
Express Your Expectations: A Fast, Compliant JSON Pull Parser for Writing Robust ApplicationsNumbers: 0, -17, 3.1415, 1e10 Objects: Collection of properties (key-value pairs) Custom objects: {id: 42, name: "Jonathan Müller", speaker: true} Arrays (keys are indices): [5, "abc", undefined] Functions @foonathan Express your expectations CppCon 2023-10-03 6JSON “Subset” of Javascript literals. { "id": 42, "name": "Jonathan Müller", "speaker": true, "talks": [ { "title": "Express your expectations" Jonathan Müller — @foonathan Express your expectations CppCon 2023-10-03 9JSON parsing in Javascript { "id": 42, "name": "Jonathan…", "speaker": true, "talks": [ … ] } let object = JSON.parse(json) console0 码力 | 143 页 | 736.91 KB | 6 月前3
min max and More• Bare-bones example: � struct student { string name; int id; inline static int registrar = 0; S( string n ) : name{ n }, id{ registrar++ } { } // c’tor friend bool // “hidden friend” operator operator < ( student s1, student s2 ) { return s1.name < s2.name; } // id is not salient }; • Since each student variable has a unique id number: � Even equal values are distinguishable, so … � It can matter argument can be observed by taking a pointer to function.” (See N1070, 1997.) � Also, suppose the caller provides a type but not a value: template< class T = int > void g( T x = { } ) { ⋯ } ⋮ g( 0 码力 | 8 页 | 2.48 MB | 6 月前3
C++23: An Overview of Almost All New and Updated Features#ifdef id shorthand for #if defined(id) #ifndef id shorthand for #if !defined(id) C++23 adds #elifdef id shorthand for #elif defined(id) #elifndef id shorthand for #elif !defined(id) #warning for (int i { startValue }; i < startValue + numberOfValues; ++i) { // Yield a value to the caller, and suspend the coroutine. co_yield i; } } int main() { auto gen { getSequenceGenerator(100 码力 | 105 页 | 759.96 KB | 6 月前3
Deciphering C++ Coroutines. ⇒ Singly-linked list of stack frames with links from callee-frame to caller-frame.32/55 Connecting a coroutine to its caller Asyncinner_function () { // ... } Async awaitable (); co_return PartialResult :: from_io_result(r); }32/55 Connecting a coroutine to its caller Async inner_function () { // ... } Async middle_function () { Async coroutine to its caller template struct Async { struct promise_type { /* ... */ }; std:: coroutine_handle self ; };35/55 Connecting a coroutine to its caller template 0 码力 | 156 页 | 1.79 MB | 6 月前3
共 183 条
- 1
- 2
- 3
- 4
- 5
- 6
- 19
相关搜索词
NeighborhoodsBandingTogetherReasoningGloballyaboutProgramsMakingLibrariesConsumableforNonC++DevelopersCombiningCoRoutinesandFunctionsintoJobSystemExceptionsUndertheSpotlightEmbracinganAdversarialMindsetCppSecurityBacktoBasicsMoveSemanticsExpressYourExpectationsFastCompliantJSONPullParserWritingRobustApplicationsminmaxMore23AnOverviewofAlmostAllNewUpdatedFeaturesDecipheringCoroutines













