 Undefined Behavior: What Every Programmer Should Know and Fearit bool f(int i) { return i + 1 > i; } // Example 01 ● Signed integer overflow is UB ● UB never happens (compiler is not required to condone UB) ● i != INT_MAX ● i + 1 is always greater than i bool g(int it bool f(int i) { return i + 1 > i; } // Example 01 ● Signed integer overflow is UB ● UB never happens (compiler is not required to condone UB) ● i != INT_MAX ● i + 1 is always greater than i bool g(int int i = 1; int main() { cout << "Before" << endl; while (i) {} cout << "After" << endl; } ● GCC, O3: prints “Before” and hangs ● CLANG, O3: prints “Before”, “After”, and exitsUndefined Behavior0 码力 | 38 页 | 2.56 MB | 6 月前3 Undefined Behavior: What Every Programmer Should Know and Fearit bool f(int i) { return i + 1 > i; } // Example 01 ● Signed integer overflow is UB ● UB never happens (compiler is not required to condone UB) ● i != INT_MAX ● i + 1 is always greater than i bool g(int it bool f(int i) { return i + 1 > i; } // Example 01 ● Signed integer overflow is UB ● UB never happens (compiler is not required to condone UB) ● i != INT_MAX ● i + 1 is always greater than i bool g(int int i = 1; int main() { cout << "Before" << endl; while (i) {} cout << "After" << endl; } ● GCC, O3: prints “Before” and hangs ● CLANG, O3: prints “Before”, “After”, and exitsUndefined Behavior0 码力 | 38 页 | 2.56 MB | 6 月前3
 Building a Coroutine-Based Job System Without Standard LibraryWhat do we do? Before we get started, just a quick self introduction about my background, I am a real-time rendering engineer at NVIDIA working on the RTX renderer in Omniverse. Before that, I was rendering functions are compiled More resources: https://gist.github.com/MattPD/9b55db49537a90545a90447392ad3aeb Before we dive into the system, I want to take 10 mins to have a quick recap about C++ coroutine and share expression into code. 1. Retreive awaiter & awaitable 2. Awaiting the awaiter(suspend and resume happens here) Awaitable & awaiter & co_await Useful to know • According to the definition, a type can0 码力 | 120 页 | 2.20 MB | 6 月前3 Building a Coroutine-Based Job System Without Standard LibraryWhat do we do? Before we get started, just a quick self introduction about my background, I am a real-time rendering engineer at NVIDIA working on the RTX renderer in Omniverse. Before that, I was rendering functions are compiled More resources: https://gist.github.com/MattPD/9b55db49537a90545a90447392ad3aeb Before we dive into the system, I want to take 10 mins to have a quick recap about C++ coroutine and share expression into code. 1. Retreive awaiter & awaitable 2. Awaiting the awaiter(suspend and resume happens here) Awaitable & awaiter & co_await Useful to know • According to the definition, a type can0 码力 | 120 页 | 2.20 MB | 6 月前3
 Back to Basics: Pointersstoring an int with value 7 ● Here we see ‘px’ again ● And we see an ‘asterisk’ before px ○ When an asterisk is before the variable name (and the type is a pointer), it means to retrieve the value at storing an int with value 7 ● Here we see ‘px’ again ● And we see an ‘asterisk’ before px ○ When an asterisk is before the variable name (and the type is a pointer), it means to retrieve the value at addresses (8/11) 36 ● Okay, so what happens with our pointer? ○ int x= 7; ○ int* px= &x; 7Visualizing Memory - Linear array of addresses (9/11) 37 ● Okay, so what happens with our pointer? ○ int x= 7;0 码力 | 152 页 | 5.61 MB | 6 月前3 Back to Basics: Pointersstoring an int with value 7 ● Here we see ‘px’ again ● And we see an ‘asterisk’ before px ○ When an asterisk is before the variable name (and the type is a pointer), it means to retrieve the value at storing an int with value 7 ● Here we see ‘px’ again ● And we see an ‘asterisk’ before px ○ When an asterisk is before the variable name (and the type is a pointer), it means to retrieve the value at addresses (8/11) 36 ● Okay, so what happens with our pointer? ○ int x= 7; ○ int* px= &x; 7Visualizing Memory - Linear array of addresses (9/11) 37 ● Okay, so what happens with our pointer? ○ int x= 7;0 码力 | 152 页 | 5.61 MB | 6 月前3
 Single Producer Single Consumer Lock-free FIFO From the Ground Upevaluations are atomic operations (see std::atomic ), or ■ one of the conflicting evaluations happens-before another (see std::memory_order ). If a data race occurs, the behavior of the program is undefined size_] if (popCursor_ < pushCursor_) ++popCursor_ if (pushCursor_ - popCursor_ != size_) need happens before Need atomic pushCursor_ and popCursor_24 template Single Producer Single Consumer Lock-free FIFO From the Ground Upevaluations are atomic operations (see std::atomic ), or ■ one of the conflicting evaluations happens-before another (see std::memory_order ). If a data race occurs, the behavior of the program is undefined size_] if (popCursor_ < pushCursor_) ++popCursor_ if (pushCursor_ - popCursor_ != size_) need happens before Need atomic pushCursor_ and popCursor_24 template- > (popCursor_ != pushCursor_) happens before new (&ring_[pushCursor_ % size_]) T(value) if (pushCursor_ - popCursor_ != size_) if (pushCursor_ - popCursor_ != size_) happens before release release acquire 0 码力 | 51 页 | 546.30 KB | 6 月前3
 Conan 2.0 Documentationwith conan config install. Deployers run before generators, and they can change the target folders. For example, if the --deployer=full_deploy deployer runs before CMakeDeps, the files generated by CMakeDeps We used the CMake already installed in our system to build our compressor binary. However, what happens if you want to build your project with a specific CMake version, different from the one already installed was created in the same folder. If you source this file you can restore the environment as it was before. Listing 12: Windows $ deactivate_conanbuild.bat Listing 13: Linux, macOS $ source deactivate_conanbuild0 码力 | 652 页 | 4.00 MB | 1 年前3 Conan 2.0 Documentationwith conan config install. Deployers run before generators, and they can change the target folders. For example, if the --deployer=full_deploy deployer runs before CMakeDeps, the files generated by CMakeDeps We used the CMake already installed in our system to build our compressor binary. However, what happens if you want to build your project with a specific CMake version, different from the one already installed was created in the same folder. If you source this file you can restore the environment as it was before. Listing 12: Windows $ deactivate_conanbuild.bat Listing 13: Linux, macOS $ source deactivate_conanbuild0 码力 | 652 页 | 4.00 MB | 1 年前3
 Conan 2.1 Documentationwith conan config install. Deployers run before generators, and they can change the target folders. For example, if the --deployer=full_deploy deployer runs before CMakeDeps, the files generated by CMakeDeps of those sources in your own server, so your builds are always fully reproducible, no matter what happens to the original internet sources. See also: • the backup-sources blog post 2.15. Package lists We used the CMake already installed in our system to build our compressor binary. However, what happens if you want to build your project with a specific CMake version, different from the one already installed0 码力 | 694 页 | 4.13 MB | 1 年前3 Conan 2.1 Documentationwith conan config install. Deployers run before generators, and they can change the target folders. For example, if the --deployer=full_deploy deployer runs before CMakeDeps, the files generated by CMakeDeps of those sources in your own server, so your builds are always fully reproducible, no matter what happens to the original internet sources. See also: • the backup-sources blog post 2.15. Package lists We used the CMake already installed in our system to build our compressor binary. However, what happens if you want to build your project with a specific CMake version, different from the one already installed0 码力 | 694 页 | 4.13 MB | 1 年前3
 Conan 2.10 Documentationwith conan config install. Deployers run before generators, and they can change the target folders. For example, if the --deployer=full_deploy deployer runs before CMakeDeps, the files generated by CMakeDeps of those sources in your own server, so your builds are always fully reproducible, no matter what happens to the original internet sources. See also: • the backup-sources blog post 2.18 Installing configuration We used the CMake already installed in our system to build our compressor binary. However, what happens if you want to build your project with a specific CMake version, different from the one already installed0 码力 | 803 页 | 5.02 MB | 10 月前3 Conan 2.10 Documentationwith conan config install. Deployers run before generators, and they can change the target folders. For example, if the --deployer=full_deploy deployer runs before CMakeDeps, the files generated by CMakeDeps of those sources in your own server, so your builds are always fully reproducible, no matter what happens to the original internet sources. See also: • the backup-sources blog post 2.18 Installing configuration We used the CMake already installed in our system to build our compressor binary. However, what happens if you want to build your project with a specific CMake version, different from the one already installed0 码力 | 803 页 | 5.02 MB | 10 月前3
 Conan 2.9 Documentationwith conan config install. Deployers run before generators, and they can change the target folders. For example, if the --deployer=full_deploy deployer runs before CMakeDeps, the files generated by CMakeDeps of those sources in your own server, so your builds are always fully reproducible, no matter what happens to the original internet sources. See also: • the backup-sources blog post 2.18 Installing configuration We used the CMake already installed in our system to build our compressor binary. However, what happens if you want to build your project with a specific CMake version, different from the one already installed0 码力 | 795 页 | 4.99 MB | 10 月前3 Conan 2.9 Documentationwith conan config install. Deployers run before generators, and they can change the target folders. For example, if the --deployer=full_deploy deployer runs before CMakeDeps, the files generated by CMakeDeps of those sources in your own server, so your builds are always fully reproducible, no matter what happens to the original internet sources. See also: • the backup-sources blog post 2.18 Installing configuration We used the CMake already installed in our system to build our compressor binary. However, what happens if you want to build your project with a specific CMake version, different from the one already installed0 码力 | 795 页 | 4.99 MB | 10 月前3
 Back to Basics: Concurrencymatters, and sometimes tasks have to wait on shared resources. 2. Parallelism Definition: Everything happens at once, instantaneously 18Parallelism vs Concurrency (programming context) (2/4) Concurrency is matters, and sometimes tasks have to wait on shared resources. 2. Parallelism Definition: Everything happens at once, instantaneously 19Parallelism vs Concurrency (programming context) (3/4) Concurrency is matters, and sometimes tasks have to wait on shared resources. 2. Parallelism Definition: Everything happens at once, instantaneously 20 “The world is concurrent.” - Joe ArmstrongParallelism vs Concurrency0 码力 | 141 页 | 6.02 MB | 6 月前3 Back to Basics: Concurrencymatters, and sometimes tasks have to wait on shared resources. 2. Parallelism Definition: Everything happens at once, instantaneously 18Parallelism vs Concurrency (programming context) (2/4) Concurrency is matters, and sometimes tasks have to wait on shared resources. 2. Parallelism Definition: Everything happens at once, instantaneously 19Parallelism vs Concurrency (programming context) (3/4) Concurrency is matters, and sometimes tasks have to wait on shared resources. 2. Parallelism Definition: Everything happens at once, instantaneously 20 “The world is concurrent.” - Joe ArmstrongParallelism vs Concurrency0 码力 | 141 页 | 6.02 MB | 6 月前3
 Conan 2.5 Documentationwith conan config install. Deployers run before generators, and they can change the target folders. For example, if the --deployer=full_deploy deployer runs before CMakeDeps, the files generated by CMakeDeps of those sources in your own server, so your builds are always fully reproducible, no matter what happens to the original internet sources. See also: • the backup-sources blog post 2.18 Installing configuration We used the CMake already installed in our system to build our compressor binary. However, what happens if you want to build your project with a specific CMake version, different from the one already installed0 码力 | 769 页 | 4.70 MB | 1 年前3 Conan 2.5 Documentationwith conan config install. Deployers run before generators, and they can change the target folders. For example, if the --deployer=full_deploy deployer runs before CMakeDeps, the files generated by CMakeDeps of those sources in your own server, so your builds are always fully reproducible, no matter what happens to the original internet sources. See also: • the backup-sources blog post 2.18 Installing configuration We used the CMake already installed in our system to build our compressor binary. However, what happens if you want to build your project with a specific CMake version, different from the one already installed0 码力 | 769 页 | 4.70 MB | 1 年前3
共 246 条
- 1
- 2
- 3
- 4
- 5
- 6
- 25














