C++ - Reddit
226 subscribers
48 photos
8 videos
1 file
25.7K links
Stay up-to-date with everything C++!
Content directly fetched from the subreddit just for you.

Join our group for discussions : @programminginc

Powered by : @r_channels
Download Telegram
MSVC 14.52, migration code to C++23

Now that MSVC 14.52 is released with Visual Studio 2026 18.12 I have tried to rebuild the project I am working on with /std:c++23. Thx for finally releasing C++23 support.

I have previously used /std:c++23preview and my assumption was that the migration would be effortless. But not so. So this is a heads up.

Most of the issues I have ran into is related to C++23 and how incomplete types are used in headers. So C++23 changed so that std::uniqueptr destructor now is constexpr. This means that I have to add/move destructor to .cpp source file.
For reference, see Github issues
https://github.com/microsoft/STL/issues/4215 and https://github.com/microsoft/STL/issues/4417

But I also have issues with code like:

// Forward declaration
class Foo;

class A
{
public:
void Add(const Foo & foo ) {
foos.pushback(foo); }

private:
std::vector<Foo>
foos;
};

class Foo
{
};

Godbolt with MSVC 14.51 and /std:c++23preview - https://godbolt.org/z/ae5M53fK1
Works also perfectly well in GCC 16.2 -std=c++23 - https://godbolt.org/z/rhEM5MMhG

As of this writing MSVC 14.52 and /std:c++23 is not yet available on Godbolt.

But I get error C2139: 'Foo': an undefined class is not allowed as an argument to compiler intrinsic type trait 'isnothrowconstructible'

A tad annoying.

https://redd.it/1xtc3a4
@r_cpp
main() is an architecture decision - structuring C++ apps with compile-time composition checks

Post on structuring C++ applications: components with a lifecycle, one composition root, dependencies declared as types, init/shutdown order derived from the graph (not member declaration order).

Includes a small single-header C++20 library and an example on Compiler Explorer.

https://capybot.com/2026/11/11/keel\_1/

Feedback welcome

https://redd.it/1xtpw3n
@r_cpp
Resources for implementing low-level concurrent and asynchronous systems in C++

I've been spending some time studying concurrency and asynchronous programming in C++. I have a reasonable understanding of concepts like threads, thread pools, non-blocking I/O, event loops, coroutines, and reactor/proactor patterns.

However, I feel there's a big difference between understanding how these things work and actually being able to implement them.

I'm interested in building things like network servers, runtimes, databases, and other systems software. I'm also working on a compiler, so understanding the internals of these systems is something I'd like to get better at.

What I'm looking for are resources that go beyond explaining the concepts. Books, papers, articles, courses, or open-source codebases that actually helped you implement these kinds of systems yourself.

Some areas I'm particularly interested in:

Non-blocking I/O and I/O multiplexing
Event loop implementations
Reactor and Proactor patterns
Coroutines and asynchronous runtimes
Thread pools and task scheduling
Performance and scalability in concurrent systems

I've already read a few books on concurrency, including some focused on C++, but most of them tend to focus on the programming model and how to use the standard library (threads, mutexes, futures, etc.). That's useful, but it's not quite what I'm looking for anymore. I want to understand how these things are actually built, preferably in C++. For example, implementing a thread pool, an event loop, an asynchronous runtime, or a network server rather than just learning how to use existing ones. I'd really appreciate recommendations that take this implementation-oriented approach.

https://redd.it/1xtxemd
@r_cpp
first time into c++ as a 13 year old

kinda tricky and hard to remember, I feel normal while learning but I know well good, that the more I advance, the more Its gonna torture me

https://redd.it/1xuphnw
@r_cpp
Spectre - A design-by-contract programming language with an explicit allocator-centric API that outperforms Zig and C++ by up to 6x on General Purpose Benchmarks
https://spectrelang.org/

https://redd.it/1xvnf3n
@r_cpp
How can I make it easier to use the helper class that lets me pass more than one parameter to co_await?
https://devblogs.microsoft.com/oldnewthing/20261113-00/?p=112856/

https://redd.it/1xvs788
@r_cpp
DO NOT USE FIBERS! - I did it anyway

I'm a "pro-fiber" guy, which gets lonely fast when you search the internet for friends and mostly run into Gor Nishanov tearing them apart in P1364 ("Fibers under the magnifying glass"), or Raymond Chen writing that Win32 fibers "aren't useful for much any more."

Sometimes it feels like Microsoft just lacks the imagination for where fibers actually work. Fair point though: if you try to use fibers as a general-purpose replacement for OS threads in arbitrary code, the warnings are right. TLS issues, fixed stacks, and third-party libraries blocking worker threads are very real problems.

I built a fiber-based task scheduler anyway (the first version goes back to 2007), because when you're parallelizing sequential, CPU-bound code like an encoder or compressor on a single file, the tradeoffs are completely different. You own the task code, the number of active fibers is bounded by the work in flight, and tasks often run for just tens of microseconds before waiting on each other mid-work. In that spot, OS threads cost way too much and stackless coroutines force you to tear apart existing call chains.

I wrote up my side of the story - where the usual criticism hits the mark, where it misses, and why fibers still make sense here:

https://www.thinkmeta.com/concurrenttasks/why-fibers

Any other "pro-fiber" folks out there, or has everyone moved on to stackless coroutines / std::execution?

https://redd.it/1xw0hez
@r_cpp
Vajra Binary Core: A cross-platform C++17 engine for runtime function hooking and atomic memory layout migration

Hi everyone,

I’ve open-sourced a systems-level library I've been developing: **Vajra Binary Core**. It’s designed for runtime binary instrumentation, allowing native C++ binaries to patch function machine code and migrate object memory layouts on-the-fly without restarting the process.

The main technical challenge was combining safe instruction-level hooking with transactional state migration for complex objects in memory.

# Core Architecture & Implementation Details:

1. **Instruction Length Decoder (x86-64):**
* Built a custom decoder handling complex prefixes (`REX`, `VEX`, `EVEX`) and addressing modes.
* Verified against `objdump` parsing over 2 million instructions from standard system libraries (`libc`, `libstdc++`) to ensure exact instruction boundary matching.
2. **Hooking & Trampolines:**
* Handles RIP-relative operand adjustments during function prologue relocation.
* Implements atomic multi-hook installation combined with IAT redirection (on Windows) and GOT/PLT management (on Linux).
3. **Thread Safety & Safe Points:**
* Enforces thread suspension mechanisms and cooperative safe points before writing to executable memory pages (avoiding `W^X` violations safely via temporary page permission swapping).
4. **Stateful Type Migration & Transactions:**
* Provides an "all-or-nothing" transactional wrapper: if pointer fixing, schema remapping, or invariant checks fail during live object restructuring, the entire patch rolls back.
* Supports field remapping, default values, numeric casts, and internal pointer corrections for interrelated objects in heap memory.

# Testing & CI:

The codebase is header-light and heavily tested with 75+ test cases across 11 test suites. The CI pipeline covers:

* **Linux:** GCC, Clang, Debug `-O0`, ASan + UBSan, and ThreadSanitizer.
* **Windows:** MinGW-w64 (`MINGW64` and `UCRT64` environments).

You can inspect the source code, design documentation, and test cases here:**GitHub:** [https://github.com/SemyonZamiakin/VajraBinaryCore](https://github.com/SemyonZamiakin/VajraBinaryCore)

I'd be glad to hear thoughts from the community regarding memory safety edge cases, instruction parsing optimizations, or alternative approaches to live schema migration in native C++.

https://redd.it/1xwb3wj
@r_cpp
clice 1.0: a C++ language server built on Clang, with C++20 modules out of the box, non-self-contained headers, and crash isolation

Hi r/cpp! I've been working on clice, a C++ language server built on Clang, for about two and a half years, and 1.0 is out today. The main differences from clangd:

- Every compile runs in a worker process, so a Clang crash costs one request instead of the whole server.

- C++20 modules work out of the box from a `compile_commands.json`, with PCHs and PCMs cached on disk across sessions.

- Non-self-contained headers are compiled in the context of a file that includes them, and you can switch contexts and build configurations.

- Template support: completion and go-to-implementation through dependent names, using instantiations when there are any.

- A CLI to index, query, refactor and modularize whole projects.

The post covers the features and the story behind it. Binaries for Linux, macOS and Windows (x64 and arm64) are on the release page, and the VS Code extension is on the Marketplace. Feedback and bug reports are very welcome!

Release post: https://ykiko.me/en/articles/2105384023094834022/

https://redd.it/1xwyk9n
@r_cpp
Why haven't C++ subset compilers been made/caught on?

At work, I write real time software. Seeing where allocations happen and having guarantees on the behaviour of code would be nice. Compile times can be much faster and optimisations can also be aggressive when you know you're restricted to a subset of the language.

https://redd.it/1xxiyvm
@r_cpp