CROSS PLATFORM PITFALLS AND HOW TO AVOID THEMCROSS-PLATFORM PITFALLS AND HOW TO AVOID THEM Erika Sweet (she/her) Microsoft C++ TeamWelcome to CppCon 2020! Visit our table at the Expo Hall https://aka.ms/cppcon/expo • Meet the Microsoft C++ Abdicating responsibility to CMake Reimplementing functionality that CMake has built-in to abstract platform and compiler specificsUse built-in CMake command line tools…. execute_process(COMMAND ${CMAKE_COMMAND} rget PUBLIC cxx_std_11) …instead of manually setting flags via CMAKE_CXX_FLAGSKeep your paths platform independent…. target_include_directories(myTarget PUBLIC $0 码力 | 67 页 | 360.44 KB | 6 月前3
Cross-Platform Floating-Point Determinism Out of the Boxof) 2 3Why FP Determinism is Important?_ CppCon 2024 sixit:: 5 ✅ Same Executable Cross Platform Different Contexts ❌ ❌ 1 (Sort of) 2 3 General Sanity, Testability Distributed Simulations using the identically compiled files and run on systems that adhere to the IEEE standards. Cross platform synchronized network simulations or replays will not possible [sic].” - Most upvoted answer on0 码力 | 31 页 | 3.88 MB | 6 月前3
High-Performance Cross-Platform Architecture: C++20 Innovationscareer in video games and embedded software • Started using C++ in 1995 • First cross-platform project in 1994Cross-Platform Architecture Goals • Take advantage of all platforms • Focus on the compiler • Minimize classes, an illustrative example from a larger project • Project build issues • Inclusion of platform-specific header files • Concept hierarchies • Class and Function DesignOCP: The Open–Closed Principle Adding new revisions to a feature has no effect on previously-implemented revisions.What is a Platform? • A specific set of features • A feature is an abstract unit of functionality requiring implementations0 码力 | 75 页 | 581.83 KB | 6 月前3
Interesting Upcoming Features from Low Latency, Parallelism and ConcurrencyreadAndAccess(Func userFn) { // Called frequently hazard_pointer hp = make_hazard_pointer(); // Construct hazard pointer. T* ptr = hp.protect(src_); // Get pointer to a protected object hazard_pointer hp[3]; /* Three hazard pointers are made nonempty separately. */ hp[0] = make_hazard_pointer(); hp[1] = make_hazard_pointer(); hp[2] = make_hazard_pointer(); assert(!hp[0].empty()); empty()); assert(!hp[1].empty()); assert(!hp[2].empty()); /* src is atomic*/ T* ptr = hp[0].protect(src); /* etc */ } /* Three nonempty hazard pointers are destroyed separately. */ Batch 0 码力 | 56 页 | 514.85 KB | 6 月前3
Tracy: A Profiler You Don't Want to Missmeasurements (nanosecond resolution) Negligible overhead (a few nanoseconds per zone) Cross-platform (Windows, Linux, macOS, iOS, Android, WASM*) Hybrid profiling capabilities (sampling and/or instrumentation) measurements (nanosecond resolution) Negligible overhead (a few nanoseconds per zone) Cross-platform (Windows, Linux, macOS, iOS, Android, WASM*) Hybrid profiling capabilities (sampling and/or instrumentation) measurements (nanosecond resolution) Negligible overhead (a few nanoseconds per zone) Cross-platform (Windows, Linux, macOS, iOS, Android, WASM*) Hybrid profiling capabilities (sampling and/or instrumentation)0 码力 | 84 页 | 8.70 MB | 6 月前3
Tracy: A Profiler You Don't Want to Missmeasurements (nanosecond resolution) Negligible overhead (a few nanoseconds per zone) Cross-platform (Windows, Linux, macOS, iOS, Android, WASM*) Hybrid profiling capabilities (sampling and/or instrumentation) measurements (nanosecond resolution) Negligible overhead (a few nanoseconds per zone) Cross-platform (Windows, Linux, macOS, iOS, Android, WASM*) Hybrid profiling capabilities (sampling and/or instrumentation) measurements (nanosecond resolution) Negligible overhead (a few nanoseconds per zone) Cross-platform (Windows, Linux, macOS, iOS, Android, WASM*) Hybrid profiling capabilities (sampling and/or instrumentation)0 码力 | 85 页 | 6.51 MB | 6 月前3
hazard pointer synchronous reclamationpointer A SRC A hazard pointer is a single-writer multi-reader pointer. set HP to A if SRC == A clear HP 2 3 6 if HP != A HP Safe to delete A A 7 8 SAFE ACCESS If a hazard pointer points to an object0 码力 | 31 页 | 856.38 KB | 6 月前3
Dependency Injection in C++Injection Hazards void Processor::buildQuoteNZFlag(const Side& side) { // ... const Exch::TickHelper& hp = updater_.processingContext().exchanges().get(side.exchangeNumber()).legacyTickHelper(); // ... } Dependency Injection Hazards void Processor::buildQuoteNZFlag(const Side& side, const LegacyTickHelper& hp ) { // ... } Law of Demeter : Only talk to your immediate friends Reaching through multiple objectsBloomberg0 码力 | 106 页 | 1.76 MB | 6 月前3
CppCon2021 Concurrency TS2 Barriers: Adapted into C++ 20 • Atomic smart pointers: Adapted into C++17 6 © 2021. 7 Talking about HP and RCU since 2014 1.Erwin Schrödinger’s Zoo and Werner Heisenberg’s advice 2.Increase uncertainty0 码力 | 58 页 | 1.62 MB | 6 月前0.03
Continuous Regression Testing for Safer and Faster Refactoringcomplex software systems that are costly and dif�cult to maintain.” “In a suf�ciently long time horizon, all possible behaviors of your system will occur.” - Hyrum's law (modi�ed)14 Aurora Innovation0 码力 | 85 页 | 11.66 MB | 6 月前3
共 147 条
- 1
- 2
- 3
- 4
- 5
- 6
- 15
相关搜索词
CROSSPLATFORMPITFALLSANDHOWTOAVOIDTHEMCrossPlatformFloatingPointDeterminismOutoftheBoxHighPerformanceArchitectureC++20InnovationsInterestingUpcomingFeaturesfromLowLatencyParallelismandConcurrencyTracyProfilerYouDonWanttoMisshazardpointersynchronousreclamationDependencyInjectionincppcon2021ConcurrencyTS2ContinuousRegressionTestingforSaferFasterRefactoring













