Best of C++ — July 2024
- 1
- 2
Community Picks·2y
Memory Safety in C++ vs Rust vs Zig
The post compares C++, Rust, and Zig in terms of memory safety. C++ offers freedom but can lead to unsafe memory practices; Circle C++ provides stricter safety features while maintaining compatibility with existing codebases. Rust ensures exceptional memory safety with a strict compiler and concepts like the borrow checker. Zig strikes a balance with reasonable memory safety and ease of use, making it simpler to integrate into existing projects. Key focus areas include lifetime safety, type safety, and runtime safety, highlighting how each language handles these aspects differently.
- 3
C++·2y
using std::cpp 2024
The using std::cpp 2024 conference, held from April 24-26 at Universidad Carlos III de Madrid, attracted over 170 attendees, primarily from the industry. The event featured keynote speakers, various talks, and workshops, focusing on modern C++ trends and practices. The registration fees contributed to a fund supporting students with economic needs. Attendees reported a shift towards newer C++ versions and common use of tools like CMake and version control. The best talk award went to Juan Alday for discussing IT pitfalls in rapid growth.
- 4
Lobsters·2yC++ Design Patterns For Low-Latency Applications
Performance optimizations remain crucial in applications like high-frequency trading (HFT), where low latency is essential. This post discusses a preprint article from Imperial College London focusing on design patterns in C++ for low-latency applications. The optimizations include common practices like prewarming CPU caches and advanced techniques like hotpath versus coldpath separation. Benchmarks using Google Benchmark demonstrate the effectiveness of these patterns, and the detailed implementations are available on GitHub.
- 5
Hacker News·2y
Fast Multidimensional Matrix Multiplication on CPU from Scratch
Recreating fast multidimensional matrix multiplication from scratch using C++ can achieve significant performance boosts through various optimization techniques. These include using compiler flags, loop reordering, tiling, and multithreading. By leveraging these methods, performance can approach the optimized levels achieved by libraries such as Intel’s MKL used in Numpy. Understanding CPU architecture and effective benchmarking are crucial for successful optimization.
- 6
Lobsters·2yC++ Must Become Safer — Andrew Lilley Brinker — Software Supply Chain Security
C++ must become safer due to the critical societal impacts of software vulnerabilities, particularly those related to memory safety. While rewrites to Rust offer memory safety benefits, they are not always feasible or cost-effective for existing C++ codebases. The C++ community is exploring multiple paths to enhance safety, including contracts, profiles, successor languages, and borrow checking. These efforts are essential as C++ continues to play an important role in many critical systems, and the community must work towards making it safer.