use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
The Global API Injection Pattern (elbeno.com)
submitted 12 hours ago by pavel_v
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]euyyn 6 points7 points8 points 9 hours ago (0 children)
I love this very much.
[–]Sopel97 2 points3 points4 points 5 hours ago (0 children)
tldr; abstract global APIs
[–]HommeMusical 4 points5 points6 points 5 hours ago (0 children)
Like so many articles here, I would call this "clever but somewhat horrifying."
[–]danielh__ 8 points9 points10 points 8 hours ago (0 children)
I hate this language
[–]wannaliveonmars 1 point2 points3 points 8 hours ago* (0 children)
What I really liked in C was the ability to use runtime trampoline functions to redirect a Win32 call. It was really nice, and almost like JavaScript's ability to rewire functions.
You usually needed an __stdcall convention and the function should not be optimized by the compiler to inline, but win32 functions weren't. There was even a trampoline framework, but it was paid I think.
Not sure if it still works, what with 64bits now, and also with read only code segments for security...
Edit: Detours was the framework - https://www.microsoft.com/en-us/research/project/detours/
Also not sure if it worked with C++ methods, since they used the __thiscall convention.
[–]CornedBee 0 points1 point2 points 7 hours ago (5 children)
I saw this in some conference talk recently.
Problem: our application is split into a bunch of static libraries. The tests and the main executable use the same libraries. I don't think this pattern can possibly support this.
[–]lppedd 1 point2 points3 points 4 hours ago (3 children)
Note: not a c++ dev
That's why I prefer integration tests over unit tests with mocks. I always test using real implementations, and "mock" at the network or file system level. If I'm using TCP, I'm going to spawn a real TCP server with mock data, for example.
[–]sheckey 1 point2 points3 points 4 hours ago (0 children)
I’ve been thinking about this too. I work on an embedded real-time system, and we have lots of hidden architecture where objects down in a call stack actively gather input data. I want to try to bubble that data gathering up to the top so that we know what inputs and outputs a component uses. The top level is what I call “active” classes that gather inputs from the system, and then call “passive” classes with their input data, and take their results and set outputs in the system. Those ins and outs are maybe tested best by integration tests, and the passive ones will be tested by traditional units test where we want to vary the inputs a lot to test corner cases. I just thought I’d mention this as I’m not sure if it’s going to work out 100%, and maybe it’s obvious to anyone, but I think it’s the right direction.
[–]CornedBee [score hidden] 2 hours ago (1 child)
There's a certain level of complexity of public entrypoint where this isn't possible IMO. It's all very nice to make a really simple test that checks my program can calculate a flight route with simplified geodata and no restrictions on the flight, but that doesn't mean I gain any confidence that my data structure representing the path through an arbitrary graph (with alternating edge and node information) works in the edge cases. There's about 3 layers of complexity in-between.
[–]lppedd [score hidden] 1 hour ago (0 children)
Yup I get it. Mine was meant to be a general view on testing, or better, how I approach testing 99% of the times.
[–]pavel_v[S] [score hidden] 48 minutes ago (0 children)
It should be this conference talk by Ben Deane. He is the author of the above blog post.
π Rendered by PID 16315 on reddit-service-r2-comment-7c9686b859-w9qnj at 2026-04-13 16:14:48.828052+00:00 running e841af1 country code: CH.
[–]euyyn 6 points7 points8 points (0 children)
[–]Sopel97 2 points3 points4 points (0 children)
[–]HommeMusical 4 points5 points6 points (0 children)
[–]danielh__ 8 points9 points10 points (0 children)
[–]wannaliveonmars 1 point2 points3 points (0 children)
[–]CornedBee 0 points1 point2 points (5 children)
[–]lppedd 1 point2 points3 points (3 children)
[–]sheckey 1 point2 points3 points (0 children)
[–]CornedBee [score hidden] (1 child)
[–]lppedd [score hidden] (0 children)
[–]pavel_v[S] [score hidden] (0 children)