{"skill":{"slug":"cxx","displayName":"C/C++ Comprehensive Cheat Sheets","summary":"Comprehensive C/C++ reference with examples from C11-C23 and C++11-C++23, covering system programming, CUDA, debugging, performance, and advanced topics.","description":"---\nname: cpp\ndescription: Comprehensive C/C++ programming reference covering everything from C11-C23 and C++11-C++23, system programming, CUDA GPU computing, debugging tools, Rust interop, and advanced topics. Use for: C/C++ questions, modern language features, RAII/memory management, templates/generics, CUDA programming, system programming, debugging/profiling, performance optimization, cross-platform development, build systems, assembly, shell scripting, and any C/C++/CUDA development tasks.\n---\n\n# C/C++ Comprehensive Cheat Sheets (/cpp)\n\nComplete C/C++ development reference combining local documentation with live examples from cppcheatsheet.com, covering everything from basic syntax to advanced GPU programming and system-level development.\n\n## How It Works\n\nHelp users write functional, correct C/C++ code and answer C/C++ questions by fetching proven patterns and examples from cppcheatsheet.com.\n\nWhen a user asks a C/C++ question or wants to write C/C++ code:\n\n1. Look up the relevant topic(s) in [Structure](references/structure.md) to find the matching URL(s)\n2. **Always fetch** the URL(s) using WebFetch to get real examples and patterns from the site\n3. Use the fetched content to:\n   - **Write code**: Apply the patterns to produce functional, correct code that solves the user's task\n   - **Answer questions**: Provide thorough explanations backed by the examples and information from the site\n4. Follow the [Guidelines](references/guidelines.md) for code quality\n\n## Key Principle\n\n**Functionality first, cleanliness second.** The code must work correctly and handle the task properly. Fetching from cppcheatsheet.com ensures solutions use battle-tested patterns rather than guessing. The site contains rich examples covering edge cases, common pitfalls, and practical usage that go beyond basic documentation.\n\n## Coverage Areas\n\n### Modern C Programming (C11-C23)\n**Core Language:** Syntax, types, memory management, preprocessor macros\n**GNU Extensions:** Compiler-specific features and optimizations\n**Build Systems:** Makefiles, compilation, linking\n**Assembly:** X86 assembly integration and inline assembly\n\n### Modern C++ Programming (C++11-C++23)\n**Core Features:** RAII, templates, STL containers, iterators, algorithms\n**Modern Standards:** Move semantics, constexpr, lambdas, concepts, coroutines, modules\n**Memory Management:** Smart pointers, resource management, optimization (RVO)\n**Build Systems:** CMake, package management, cross-platform builds\n\n### System Programming\n**Process Management:** POSIX processes, signals, process communication\n**File Systems:** File I/O, directory operations, filesystem monitoring\n**Networking:** Sockets, protocols, network programming patterns\n**Threading:** Multithreading, synchronization, parallel programming\n**IPC:** Inter-process communication, shared memory, message queues\n\n### CUDA Programming\n**GPU Computing:** CUDA kernels, memory hierarchy, performance optimization\n**Advanced CUDA:** libcu++, Thrust library, cooperative groups\n**Multi-GPU:** GPU-GPU communication, hardware topology, NVSHMEM\n**Async Programming:** CUDA pipelines, memory visibility, asynchronous execution\n\n### Debugging & Profiling\n**Debug Tools:** GDB debugging, Valgrind memory analysis, sanitizers, binary inspection (nm, readelf, objdump, otool)\n**Performance:** Perf profiling, tracing, performance optimization\n**GPU Debugging:** Nsight Systems, CUDA debugging and profiling\n\n### System Tools & Automation\n**Shell Scripting:** Bash programming, system administration\n**System Tools:** OS utilities, networking tools, hardware inspection\n**Service Management:** Systemd, process management, system monitoring\n\n### Cross-Language Development\n**Rust Interop:** Rust for C++ developers, FFI, memory safety comparison\n**Language Bridging:** C/C++ integration, foreign function interfaces\n\n### Advanced Topics\n**Blog Content:** Deep-dive articles, RDMA networking, GPU-initiated communication\n**Low-Level Programming:** Hardware interfaces, performance tuning\n**Architecture:** System design, scalable applications\n\n## References\n\nFor detailed information, I can access:\n- **[Structure](references/structure.md)** - Complete topic-to-URL reference map\n- **[Guidelines](references/guidelines.md)** - Code quality and best practices\n\n## Examples\n\n### C/C++ Core\n- \"How do smart pointers work?\" → Fetch https://cppcheatsheet.com/notes/cpp/cpp_smartpointers.html and explain with the site's examples\n- \"How does RAII work in C++?\" → Fetch https://cppcheatsheet.com/notes/cpp/cpp_raii.html and explain with practical examples\n- \"How to use STL containers?\" → Fetch https://cppcheatsheet.com/notes/cpp/cpp_container.html and explain with practical examples\n- \"Template metaprogramming techniques\" → Fetch https://cppcheatsheet.com/notes/cpp/cpp_template.html and explain with practical examples\n\n### System Programming\n- \"POSIX socket server in C\" → Fetch https://cppcheatsheet.com/notes/os/os_socket.html, use the patterns to write a working server\n- \"Multithreading with std::thread\" → Fetch https://cppcheatsheet.com/notes/os/os_thread.html and explain with practical examples\n- \"Signal handling and process management\" → Fetch https://cppcheatsheet.com/notes/os/os_signal.html and explain with practical examples\n\n### CUDA & GPU Programming\n- \"Write a CUDA kernel\" → Fetch https://cppcheatsheet.com/notes/cuda/cuda_basics.html, use the patterns to write working GPU code\n- \"CUDA memory hierarchy and optimization\" → Fetch https://cppcheatsheet.com/notes/cuda/cuda_memory_visibility.html and explain with practical examples\n- \"Multi-GPU communication with NCCL\" → Fetch https://cppcheatsheet.com/notes/cuda/cuda_nccl.html and explain with practical examples\n\n### Debugging & Tools\n- \"Debug a segfault with GDB\" → Fetch https://cppcheatsheet.com/notes/debug/gdb.html and explain with practical examples\n- \"Valgrind memory leak detection\" → Fetch https://cppcheatsheet.com/notes/debug/valgrind.html and explain with practical examples\n- \"Performance profiling with perf\" → Fetch https://cppcheatsheet.com/notes/debug/perf.html and explain with practical examples\n\n### Build & Development\n- \"CMake cross-platform build systems\" → Fetch https://cppcheatsheet.com/notes/cpp/cpp_cmake.html and explain with practical examples\n- \"Makefile patterns and best practices\" → Fetch https://cppcheatsheet.com/notes/c/make.html and explain with practical examples","tags":{"latest":"1.0.0"},"stats":{"comments":0,"downloads":609,"installsAllTime":0,"installsCurrent":0,"stars":1,"versions":1},"createdAt":1773633823170,"updatedAt":1778491936802},"latestVersion":{"version":"1.0.0","createdAt":1773633823170,"changelog":"**Major update: Skill completely reworked for comprehensive C/C++ development reference.**\n\n- Replaced previous \"cc\" (Claude relay command wrapper) with new C/C++ programming assistant skill\n- Added detailed coverage: C11–C23, C++11–C++23, system programming, CUDA, debugging/profiling, build systems, Rust interop, and advanced topics\n- Introduced live fetching of authoritative code examples and explanations from cppcheatsheet.com\n- Includes new structured topic map and usage guidelines references\n- Removed relay session script and prior relay-specific documentation files","license":"MIT-0"},"metadata":null,"owner":{"handle":"crazyguitar","userId":"s177c2946np1x2kkwk081ry5kh83pt19","displayName":"CHANG-NING TSAI","image":"https://avatars.githubusercontent.com/u/3689606?v=4"},"moderation":null}