How Meta Made Debugging Async Code Easier with Coroutines and Sendersfex::linuxos::io_uring_context::async_read_only_file) () at /home/cppcon/cppcon24-async-demo/src/main.cpp:70 frame #1 : 0x0000555555583b08 in std::__1::coroutine_handle::resume[abi:ne180100]() main () at /home/cppcon/cppcon24-async-demo/src/main.cpp:10 frame #15: 0x0000555555557604 in main () at /home/cppcon/cppcon24-async-demo/src/main.cpp:10 frame #16: 0x0000555555557604 in main () () at /home/cppcon/cppcon24-async-demo/src/main.cpp:10 frame #17: 0x000055555555761c in main () at /home/cppcon/cppcon24-async-demo/src/main.cpp:10 frame #18: 0x00007ffff7b1e083 in __libc_start_main 0 码力 | 131 页 | 907.41 KB | 6 月前3
LLVM's Realtime Safety Revolution: Tools for Modern Mission Critical Systemsstd::__1::__libcpp_allocate[abi:v160006](unsigned long, unsigned long)+0x44 > clang -fsanitize=address main.cpp #includeint main() { auto v = std::vector (16); return v[16]; }Using process(float x) { auto const y = std::vector (16); ... } > clang++ -fsanitize=realtime main.cpp > ./a.out ==86660==ERROR: RealtimeSanitizer: unsafe-library-call Intercepted call to real-time process(float x) { auto y = std::vector (16); ... } > clang++ -fsanitize=realtime main.cpp > ./a.out ==86660==ERROR: RealtimeSanitizer: unsafe-library-call Intercepted call to real-time 0 码力 | 153 页 | 1.38 MB | 6 月前3
Just-In-Time Compilation: The Next Big ThingLIBRARY/BINARY 6 . 12SAVE LIBRARY/BINARY SAVE LIBRARY/BINARY MAIN.CPP MAIN.CPP 6 . 12SAVE LIBRARY/BINARY SAVE LIBRARY/BINARY MAIN.CPP MAIN.CPP #include// std::stoi void dispatch(int); // _Z3dispatchi _Z3dispatchi - Mangled symbol with no templates 6 . 12SAVE LIBRARY/BINARY SAVE LIBRARY/BINARY MAIN.CPP MAIN.CPP #include // std::stoi void dispatch(int); // _Z3dispatchi - Mangled symbol with argv) { dispatch(std::stoi(argv[1])); } 6 . 12SAVE LIBRARY/BINARY SAVE LIBRARY/BINARY MAIN.CPP MAIN.CPP LLC - LLC - #include // std::stoi void dispatch(int); // _Z3dispatchi - Mangled 0 码力 | 222 页 | 5.45 MB | 6 月前3
C++ Modules: Getting Started Today— File: my function.cpp char const* my_function () { return "Hello from function!"; } — File: main.cpp #include#include int main () { std:: println("{}", my_function ()); hpp { return 42; }6/50 Including files twice does not work — File: a.hpp class A {}; — File: main.cpp #include #include // redefiniton error! int main () { }7/50 Included files private: char const* u_cant_touch_this () { return "Preprocessor hits me so hard"; } }; — File: main.cpp #define private public #include #undef private int main () { std:: println("{}", A{} 0 码力 | 65 页 | 1.97 MB | 6 月前3
C++高性能并行编程与优化 - 课件 - 01 学 C++ 从 CMake 学起https://github.com/zenustech/zeno ) 什么是编译器 • 编译器,是一个根据源代码生成机器码的程序。 • > g++ main.cpp -o a.out • 该命令会调用编译器程序 g++ ,让他读取 main.cpp 中的字符串(称为源码),并根据 C+ + 标准生成相应的机器指令码,输出到 a.out 这个文件中,(称为可执行文件)。 • > ./a.out 工程变大时,编译时间变得很长,改动一个地方就得全部重新编译。 • 因此,我们提出多文件编译的概念,文件之间通过符号声明相互引用。 • > g++ -c hello.cpp -o hello.o • > g++ -c main.cpp -o main.o • 其中使用 -c 选项指定生成临时的对象文件 main.o ,之后再根据一系列对象文件进行链接 ,得到最终的 a.out : • > g++ hello.o main 指明依赖关系的好处: 1. 当更新了 hello.cpp 时只会重新编译 hello.o ,而不需要把 main.o 也重新编译一遍。 2. 能够自动并行地发起对 hello.cpp 和 main.cpp 的编译,加快编译速度( make -j )。 3. 用通配符批量生成构建规则,避免针对每个 .cpp 和 .o 重复写 g++ 命令( %.o: %.cpp )。 • 但坏处也很明显:0 码力 | 32 页 | 11.40 MB | 1 年前3
Why is my Build so Slow000 Lines!Includes 30 clang main.cpp -stdlib=libc++ -E &> prep_main.cpp $ du -bh main.cpp 82 main.cpp $ du -bh prep_main.cpp 2.9M prep_main.cppIncludes clang main.cpp -stdlib=libc++ -ftime-trace 31Includes int main() { std::cout << "Hello, world!" << std::endl; } 52 clang -I… -stdlib=libc++ main.cpp ������53545556Compiler Include Paths - Interacting with the filesystem is not free - Caches abound0 码力 | 71 页 | 3.96 MB | 6 月前3
C++高性能并行编程与优化 - 课件 - 11 现代 CMake 进阶指南,那样会让你的项目无法被人作为子模块使用。 其他相关变量 • PROJECT_SOURCE_DIR :当前项目源码路径(存放 main.cpp 的地方) • PROJECT_BINARY_DIR :当前项目输出路径(存放 main.exe 的地方) • CMAKE_SOURCE_DIR :根项目源码路径(存放 main.cpp 的地方) • CMAKE_BINARY_DIR :根项目输出路径(存放 main.exe 的地方) 构建工程的产生器。它将产生构建文件 (e.g. "Unix Makefiles", "Visual Studio 2019", etc.) 一个标准的 CMakeLists.txt 模板 第 3 章:链接库文件 main.cpp 调用 mylib.cpp 里的 say_hello 函数 改进: mylib 作为一个静态库 改进: mylib 作为一个动态库 改进: mylib 作为一个对象库 https://www “hello;world”) 如果 message 没加引号会怎样?会把列表里的字符串当成他的关键字 结论:除非确实需要列表,建议始终在你不确定的地方加上引号,例如: set(sources “main.cpp” “mylib.cpp” “C:/Program Files/a.cpp”) message(“${sources}”) 第 7 章:变量与缓存 重复执行 cmake -B build 会有什么区别?0 码力 | 166 页 | 6.54 MB | 1 年前3
Back to Basics Testing} Assertion failed: (add( 1, 2 ) == 3), function main, file /Users/phil/Dev/Scratch/AddTest/main.cpp, line 8. Process finished with exit code 6#includeint add( int a, int b ){ return } Assertion failed: (add( 1, 2 ) == 3), function main, file /Users/phil/Dev/Scratch/AddTest/main.cpp, line 8. Process finished with exit code 6#include int add( int a, int b ){ return } Assertion failed: (add( 1, 2 ) == 3), function main, file /Users/phil/Dev/Scratch/AddTest/main.cpp, line 8. Process finished with exit code 6#include int add( int a, int b ){ return 0 码力 | 79 页 | 25.86 MB | 6 月前3
Back To Basics Functionsincludes the add.hpp -- this is effectively the forward declaration being pasted in ○ Finally, the main.cpp ■ We #include “add.hpp” which gives us access to use add.cpp ■ So long as we link in the implementation includes the add.hpp -- this is effectively the forward declaration being pasted in ○ Finally, the main.cpp ■ We #include “add.hpp” which gives us access to use add.cpp ■ So long as we link in the implementation includes the add.hpp -- this is effectively the forward declaration being pasted in ○ Finally, the main.cpp ■ We #include “add.hpp” which gives us access to use add.cpp ■ So long as we link in the implementation0 码力 | 123 页 | 7.26 MB | 6 月前3
C++高性能并行编程与优化 - 课件 - 16 现代 CMake 模块化项目管理指南src/*.cpp) • 疑问 1 :都是按照通配符批量匹配文件,有什么区别? • GLOB : src/main.cpp (√) src/test/main.cpp ( × ) • GLOB_RECURSE : src/main.cpp (√) src/test/main.cpp (√) • 区别在于 GLOB_RECURSE 允许 * 匹配嵌套的目录。 • 疑问 2 :加了 CONFIGURE_DEPENDS0 码力 | 56 页 | 6.87 MB | 1 年前3
共 111 条
- 1
- 2
- 3
- 4
- 5
- 6
- 12













