Sender Patterns to Wrangle Concurrency in Embedded Devices
a2); 7 8 int var = 0; 9 10 11 | async::then<"before-wa-then">([](auto v){ things::var = v; }) 12 | async::seq(w) 13 | async::then<"last-then">([](auto ...){ ++things::var; }) 14 | a2); 7 8 int var = 0; 9 10 11 | async::then<"before-wa-then">([](auto v){ things::var = v; }) 12 | async::seq(w) 13 | async::then<"last-then">([](auto ...){ ++things::var; }) 14 | ings::s); 19 20 while(true) {} 21 } 22 | async::then<"before-wa-then">([](auto v){ things::var = v; }) namespace things { 1 int av = 0; 2 3 auto a0 = async::just<"just-a0">(0); 4 auto a1 =0 码力 | 106 页 | 26.36 MB | 5 月前3Finding Bugs using Path-Sensitive Static Analysis
bool cond) { int var = 0; // branch 1 if (p != nullptr) { var = 1; } // branch 2 if (cond) { var = 2; p = nullptr; } // branch 3 if (var == 1) { *p = 42; bool cond) { int var = 0; // branch 1 if (p != nullptr) { var = 1; } // branch 2 if (cond) { var = 2; p = nullptr; } // branch 3 if (var == 1) { *p = 42; cond) { int var = 0; // branch 1 if (p != nullptr) { var = 1; } else {} // branch 2 if (cond) { var = 2; p = nullptr; } // branch 3 if (var == 1) { *p0 码力 | 35 页 | 14.13 MB | 5 月前3Back to Basics Casting
ConversionsExplicit Type Conversions a.k.a CastsC-style cast 1. Create a temporary ofusing var 2. can be any valid type with qualifiers 3. Overrides the type system by changing the meaning com/w/cpp/language/operator_precedence ( )varC-style cast 1. Create a temporary of using var 2. can be any valid type with qualifiers 3. Overrides the type system by changing the meaning operator precedence (level 3) https://en.cppreference.com/w/cpp/language/operator_precedence ( )var struct A{}; struct B{}; int main() { float f = 7.406f; int i = (int)f; A* pa = (A*)&f; B* pb = (B*)pa; 0 码力 | 117 页 | 1.57 MB | 5 月前3Data Is All You Need for Fusion
finalize(); pipeline.split(1, outer, inner, outer_step, 4); pipeline.parrallelize(1); pipeline.bind(len_var, 4); pipeline.breakPipeline(0); subpipe = pipeline.subpipeline(0, 1);Controlling Properties of the finalize(); pipeline.split(1, outer, inner, outer_step, 4); pipeline.parrallelize(1); pipeline.bind(len_var, 4); pipeline.breakPipeline(0); subpipe = pipeline.subpipeline(0, 1);Controlling Properties of the finalize(); pipeline.split(1, outer, inner, outer_step, 4); pipeline.parrallelize(1); pipeline.bind(len_var, 4); pipeline.breakPipeline(0); subpipe = pipeline.subpipeline(0, 1);Controlling Properties of the0 码力 | 151 页 | 9.90 MB | 5 月前3Some Things C++ Does Right
f(g(x)); … but the calling code has to explicitly state types T, U and R: public static void Main() { var f = F_G_X( n => -n, n => n * 2 ); Console.WriteLine(f(3)); }A word about beauty and => x => f(g(x)); 60 auto f = f_g_x( [](auto x) { return –x; }, [](auto x) { return x * 2; } ); var f = F_G_X ( n => -n, n => n * 2 );A word about beauty and elegance template var s4 = new string(); // does not compile var s5 = new string(""); // empty stringProgramming with a value-based language 0 码力 | 228 页 | 2.47 MB | 5 月前3A Journey Into Non-Virtual Polymorphism
using var_def = std::variant<*DigitalPin,*AnalogPin, *SerialPort>; var_def var{&digi}; std::get<0>(var)->set(); var = &serial; std::get(var)→send(); std::get (var)→send(); 2023 | Rud Merriam | A Journey into Non-Virtual Polymorphism 17 for (auto& o: outputs) { [](var_def const& value) { switch (value.index()) { case 0: std::get type in template packCppcon 2023 | Rud Merriam | A Journey into Non-Virtual Polymorphism 18 [](var_def const& value) { if (auto res = std::get_if (&value)) { (*res)->set(); } 0 码力 | 43 页 | 536.84 KB | 5 月前3Back to Basics: Move Semantics
address31 David Olsen — Back to Basics: Move Semantics — CppCon 2020 #includeLvalue int var; var = 52; const std::string hello = “Hello”; std::string greeting = hello; char* buffer = allocate_buffer(); Examples32 David Olsen — Back to Basics: Move Semantics — CppCon 2020 #include Lvalue int var; var = 52; const std::string hello = “Hello”; std::string greeting = hello; char* buffer = allocate_buffer(); lvalue33 David Olsen — Back to Basics: Move Semantics — CppCon 2020 #include Lvalue int var; var = 52; const std::string hello = “Hello”; std::string greeting = hello; char* buffer = allocate_buffer(); 0 码力 | 142 页 | 1.02 MB | 5 月前3Julia 1.11.4
is written: julia> struct MyUndefVarError <: Exception var::Symbol end julia> Base.showerror(io::IO, e::MyUndefVarError) = print(io, e.var, " not defined") Note When writing an error message, it new variable bindings each time they run. The variable need not be immediately assigned: julia> var1 = let x for i in 1:5 (i == 4) && (x = i; break) end x end 4 Whereas assignments might reassign distinct, but not guaranteed to be printed the same way across sessions. julia> typeof(x -> x + 1) var"#9#10" Types of closures are not necessarily singletons.CHAPTER 12. TYPES 149 julia> addy(y) = x0 码力 | 2007 页 | 6.73 MB | 3 月前3Julia 1.11.5 Documentation
is written: julia> struct MyUndefVarError <: Exception var::Symbol end julia> Base.showerror(io::IO, e::MyUndefVarError) = print(io, e.var, " not defined") Note When writing an error message, it new variable bindings each time they run. The variable need not be immediately assigned: julia> var1 = let x for i in 1:5 (i == 4) && (x = i; break) end x end 4 Whereas assignments might reassign distinct, but not guaranteed to be printed the same way across sessions. julia> typeof(x -> x + 1) var"#9#10" Types of closures are not necessarily singletons.CHAPTER 12. TYPES 149 julia> addy(y) = x0 码力 | 2007 页 | 6.73 MB | 3 月前3Julia 1.11.6 Release Notes
is written: julia> struct MyUndefVarError <: Exception var::Symbol end julia> Base.showerror(io::IO, e::MyUndefVarError) = print(io, e.var, " not defined") Note When writing an error message, it new variable bindings each time they run. The variable need not be immediately assigned: julia> var1 = let x for i in 1:5 (i == 4) && (x = i; break) end x end 4 Whereas assignments might reassign distinct, but not guaranteed to be printed the same way across sessions. julia> typeof(x -> x + 1) var"#9#10" Types of closures are not necessarily singletons.CHAPTER 12. TYPES 149 julia> addy(y) = x0 码力 | 2007 页 | 6.73 MB | 3 月前3
共 57 条
- 1
- 2
- 3
- 4
- 5
- 6