Hacker News with Generative AI: C++

New C++ features in GCC 15 (redhat.com)
The next major version of the GNU Compiler Collection (GCC), 15.1, is expected to be released in April or May 2025.
Some __nonstring__ Turbulence (lwn.net)
New compiler releases often bring with them new warnings; those warnings are usually welcome, since they help developers find problems before they turn into nasty bugs. Adapting to new warnings can also create disruption in the development process, though, especially when an important developer upgrades to a new compiler at an unfortunate time. This is just the scenario that played out with the 6.15-rc3 kernel release and the implementation of -Wunterminated-string-initialization in GCC 15.
C++26: more constexpr in the core language (sandordargo.com)
Since constexpr was added to the language in C++11, its scope has been gradually expanded. In the beginning, we couldn’t even use if, else or loops, which were changed in C++14. C++17 added support for constexpr lambdas. C++20 added the ability to use allocation and use std::vector and std::string in constant expressions. In this article, let’s see how constexpr evolves with C++26. To be more punctual, let’s see what language features become more constexpr-friendly.
Link-Time Optimization of Dynamic Casts in C++ Programs [pdf] (ist.utl.pt)
I started a devblog about mixing SwiftUI and C++ to make a Twitch app (kulve.org)
I figure the tech stack of Kulve is unique enough to be interesting, so seems like a good place to start for my first blog post. Kulve is a SwiftUI application that heavily leverages the Swift/C++ interop that got introducted with Swift 5.9. While it's not perfect, it offers just enough to be able to reliably blend the two languages together.
Show HN: I'm 15 and built a neural network from scratch in C++,just math (github.com/muchlakshay)
A C++ implementation of a Multilayer Perceptron (MLP) neural network using Eigen, supporting multiple activation and loss functions, mini-batch gradient descent, and backpropagation for training.
Less Slow C++ (github.com/ashvardanian)
Learning how to write "Less Slow" code in C++ 20, C 99, CUDA, PTX, & Assembly, from numerics & SIMD to coroutines, ranges, exception handling, networking and user-space IO
C++ creator Bjarne Stroustrup reimagines how coding is taught (stanforddaily.com)
At a Computer Science Education Seminar talk Thursday, C++ creator Bjarne Stroustrup shared his thoughts on the role of C++ and what needs fixing in programming education.
Raw Loops for Performance? (sandordargo.com)
To my greatest satisfaction, I’ve recently joined a new project. I started to read through the codebase before joining and at that stage, whenever I saw a possibility for a minor improvement, I raised a tiny pull request. One of my pet peeves is rooted in Sean Parent’s 2013 talk at GoingNative, Seasoning C++ where he advocated for no raw loops.
An Introduction to Modern CMake (gitlab.io)
People love to hate build systems. Just watch the talks from CppCon17 to see examples of developers making the state of build systems the brunt of jokes. This raises the question: Why? Certainly there are no shortage of problems when building. But I think that we have a very good solution to quite a few of those problems. It’s CMake. Not CMake 2.8 though; that was released before C++11 even existed!
MeshCore, a new lightweight, hybrid routing mesh protocol for packet radios (github.com/ripplebiz)
MeshCore is a lightweight, portable C++ library that enables multi-hop packet routing for embedded projects using LoRa and other packet radios.
Show HN: Single-Header Profiler for C++17 (github.com/DmitriBogdanov)
utl::profiler is single-include solution for localized profiling, it features simple macros to measure how much time is taken by a certain scope / expression / code segment. Profiler automatically builds a call graph for all profiled functions and prints a nicely formatted table for every thread. See examples.
Fun with -fsanitize=undefined and Picolibc (keithp.com)
Both GCC and Clang support the -fsanitize=undefined flag which instruments the generated code to detect places where the program wanders into parts of the C language specification which are either undefined or implementation defined. Many of these are also common programming errors. It would be great if there were sanitizers for other easily detected bugs, but for now, at least the undefined sanitizer does catch several useful problems.
EngFlow Makes C++ Builds 21x Faster and Software a Lot Safer (thenewstack.io)
C++: terser (shorter) lambda == SHORTY (ab-use?) (github.com/hanickadot)
This library is intended to give terser syntax than C++'s lambdas, not replace C++ with lazy DSL.
Understanding Memory Management, Part 4: Rust Ownership and Borrowing (educatedguesswork.org)
This is the fourth post in my planned multipart series on memory management. Part I covers the basics of memory allocation and how it works in C, and parts II and III covered the basics of C++ memory management, including RAII and smart pointers.
How to Secure Existing C and C++ Software Without Memory Safety [pdf] (arxiv.org)
The most important security benefit of software memory safety is easy to state: for C and C++ software, attackers can exploit most bugs and vulnerabilities to gain full, unfettered control of software behavior, whereas this is not true for most bugs in memory-safe software.
Taming the UB Monsters in C++ (herbsutter.com)
The C++ community broadly has a lot of hardening work well underway.
Msgpack23 – A modern, header-only C++ library for MessagePack (de)serialization (github.com/rwindegger)
msgpack23 is a lightweight library that provides a straightforward approach to serializing and deserializing C++ data structures into the MessagePack format.
C and C++ prioritize performance over correctness (2023) (swtch.com)
The original ANSI C standard, C89, introduced the concept of “undefined behavior,” which was used both to describe the effect of outright bugs like accessing memory in a freed object and also to capture the fact that existing implementations differed about handling certain aspects of the language, including use of uninitialized values, signed integer overflow, and null pointer handling.
Show HN: Hexi – Modern header-only network binary serialisation for C++ (github.com/EmberEmu)
Hexi is a lightweight, header-only C++23 library for safely handling binary data from arbitrary sources (but primarily network data). It sits somewhere between manually memcpying bytes from network buffers and full-blown serialisation libraries.
My Favorite C++ Pattern: X Macros (2023) (danilafe.com)
When I first joined the Chapel team, one pattern used in its C++-based compiler made a strong impression on me.
Building Node.js on Windows with Clang-cl (joyeecheung.github.io)
Recently Node.js started to support building with clang-cl on Windows.
Writing your own C++ standard library from scratch (blogspot.com)
The C++ standard library (also know as the STL) is, without a doubt, an astounding piece of work. Its scope, performance and incredible backwards compatibility have taken decades of work by many of the world's best programmers. My hat's off to all those people who have contributed to it.
Shift-to-Middle Array: A Faster Alternative to Std:Deque? (github.com/attilatorda)
The Shift-To-Middle Array is a dynamic array designed to optimize insertions and deletions at both ends, offering a high-performance alternative to std::deque, std::vector, and linked lists.
Reversing C++ Virtual Functions (alschwalm.com)
There are a few posts in various parts of the internet discussing reverse engineering C++, and these often address virtual functions to a large or small extent. However, I wanted to take some time to write about dealing with virtual functions in large, ‘enterprisy’ code-bases.
High-Performance PNG Decoding (blend2d.com)
It's been some time I have written about a High-Performance QOI Codec, which joined other codecs offered by Blend2D library in 2024. The development of image codecs continued and now I would like to announce a new high-performance PNG codec, which is much faster than other available codecs written in C, C++, and other programming languages.
C++26 Expansion Tricks (pydong.org)
P1306 gives us compile time repetition of a statement for each element of a range - what if we instead want the elements as a pack without introducing a new function scope?
C++26 Expansion Tricks (pydong.org)
P1306 gives us compile time repetition of a statement for each element of a range - what if we instead want the elements as a pack without introducing a new function scope?
TLS Handshake on Sockets (C++) (medium.com)
There are numerous articles on the internet about the TLS handshake algorithm. However, many of them only provide a superficial description. In this article, we will explore a C++ implementation of a specific cipher. This source code relies solely on sockets for networking and utilizes the OpenSSL library exclusively for encryption (RSA, AES, SHA).