C++ - Reddit
227 subscribers
48 photos
8 videos
1 file
25.6K 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
Are containerized development enviroments the right way to go?

I feel like I have a pretty usual context, I have a couple of interdependent C++ projects that target various targets that primarily use cmake as their build system but various compilers. I work in a team of under 7 people and each of us has their own local machine and we also have configured a pipeline that configures/builds/tests the projects.

To minimize the differences between our local machines we reached out to providing containerized images as development environments per each target. This works ok from a reproducibility perspective however it always seems limiting and clucky to me. I'm always asking myself why wouldn't I try to use the native tooling on my machine and why wouldn't I use a package manager to provide me native tooling/dependencies?

In my mind something more similar to python's venv would be much more appropriate to encapsulate the development environment, right? I was looking for similar technologies and stumbled upon nix which has a downside of only running on unix systems(so no windows)... I'm curious how others are looking at this, because from my current perspective it seems that native environment encapsulation and sharing became too hard and containerization seems to be a sign of giving up managing our dev envs natively, am I wrong?

I still see the benefit of having containerized builds but it seems to me that the development environment should be provided by something else rather than being baked into a container image. I see containers as primarily a deployment technology and I feel that somewhere along the way we pushed it to be encapsulation of the whole development environment.

https://redd.it/1xdhzhg
@r_cpp
Taking an old open source football engine and trying to bring it to Android

I've been working on Blurz Football, a native Android football game built with C++, SDL, JNI, and OpenGL ES.

It's based on the existing GameplayFootball project by Bastiaan Schuiling, including its original engine and game logic. I'm adapting it for Android and working on rendering, player models, and other improvements.

Most of my coding has been vibe-coding, and I'm still learning how the engine works. I'd appreciate feedback from people experienced with C++ game development and Android.

Here's the repo

https://redd.it/1xdtk3q
@r_cpp
0x41: Intro, NB Body + DIS voting new, and the Quiz
https://youtu.be/hEQ4IEELCwg

https://redd.it/1xecnl1
@r_cpp
Revisiting my 2014 BLAS implementation — turns out good designs don't rust :)

Back in 2014, I developed ulmBLAS, a BLAS implementation heavily inspired by the ideas of Field G. Van Zee and Robert A. van de Geijn, particularly their paper *BLIS: A Framework for Rapidly Instantiating BLAS Functionality*.

These are the same ideas behind the BLIS framework, closely related to the work of the FLAME group at UT Austin.

My goal was to build a BLAS implementation that was deliberately small, simple, and easy to understand, while still being capable of achieving serious performance.

In particular, ulmBLAS follows the BLIS approach of separating the higher-level algorithms, cache blocking, packing, and architecture-specific microkernels. The framework is intentionally kept relatively simple, but it can use microkernels derived from BLIS with suitable adaptations.

That made it particularly useful for teaching high-performance computing at Ulm University.

I wanted students to get a practical introduction to the ideas behind BLIS and FLAME, rather than just treating highly optimized numerical libraries as black boxes. They could start with a straightforward implementation of matrix multiplication and gradually introduce blocking, packing, SIMD instructions, and eventually assembly microkernels.

Most of ulmBLAS was written in 2014. After that, I largely left the code alone.

Until this week.

I finally returned to the repository, cleaned up the build system, modernized the tests, fixed a few issues, and started experimenting with newer BLIS microkernels.

The original benchmarks from 2014 used an SSE3 microkernel (if anyone still remembers SSE3 ), running on a Core 2 Duo MacBook Pro.

This week, I integrated a 6×8 AVX/FMA microkernel derived from BLIS. The integration was surprisingly straightforward, even though the newer kernel uses different register-blocking dimensions.

On an Intel Core i5-12500, ulmBLAS now reaches approximately 94–99% of OpenBLAS DGEMM performance for the larger matrix sizes tested, with roughly 2.8× the performance of the old SSE implementation.

https://redd.it/1xegh5u
@r_cpp
C++ profiles for initialization and invalidation: WIP implementation prototypes already exist in GCC/Clang
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2026/p4415r0.pdf

https://redd.it/1xesnkn
@r_cpp
Draft Proposal: Standardized Error Handling Stream (cout.error) and Mechanism (std::error) in C++

Hi everyone!

I have put together a draft proposal for introducing a standardized error-handling output stream and error policy construct in C++.

The goal is to simplify runtime error logging and program flow control (pausing or exiting) in interactive applications and games, reducing repetitive boilerplate code (like checking stream failure states or manually clearing buffers).


// Example 1: String-based error with pause behavior

std::error(std::string b{ "qqq" } && error.pause) {

cout.error <!< "hhhhh\\n"

<!< "ssasdasd"

<!< "sdasfddsasd";

}



// Example 2: Numeric error code with exit behavior

std::error(int errCode{ 12 } && error.exit) {

cout.error <!< "Error 12: Invalid mathematical operation.\\n"

<!< "The game will now shut down safely.";

}


Key ideas:

* Dedicated `cout.error` stream using a visually distinct `<!<` operator.
* Inline execution control via `error.pause` and `error.exit` modifiers.
* Support for custom error identifiers (strings, integers, floats, `constexpr`).

I would love to hear your thoughts, feedback, and constructive criticism on this draft!


Here is a step-by-step explanation of how my proposal works:

First of all, in both examples, we see `std::error`, which indicates that we want to trigger an error construct. However, every error needs an identifier. Right next to it, we have types like `std::string` or `int`. This means we can name/identify our error using a number, a single word, or a full sentence. We can pass pre-defined variables here as well—they don't have to be declared inline.

Next, we see the `&&` operator, which acts as a joiner to append modifiers: `error.pause` or `error.exit`.

* `error.pause` freezes/pauses the application execution. Once the user acknowledges and closes the message overlay, the program resumes normal execution seamlessly.
* `error.exit`, on the other hand, safely terminates the application after the user reads the message.

Below that, we introduce `cout.error`. This is a new additions to standard streams—it tells `cout` to route output specifically through the error diagnostic channel.

We also introduce a visually distinct stream insertion operator: `<!<` (which I call the *"display error info"* operator). You can pipe multiple items into it, including numbers, variables, functions, or string literals.

Regarding supported data types for the error identifier in `std::error(...)`: it supports virtually any type, including `const`, `constexpr`, `signed`, `unsigned`, floats, doubles, and strings.

If you have any questions or feedback, I'd be happy to explain further!

https://redd.it/1xewh05
@r_cpp
Cpp dispatch benchmark

A few months ago, I came across this article on this subreddit:

> Four Ways to Dispatch a Runtime-Selected Strategy in C++

Most articles on this topic discuss dispatching methods in isolation, focusing heavily on the implementation details of a single approach. However, I wanted to see the bigger picture—not just pitting virtual functions against switch statements, but measuring the actual performance footprint of each strategy in real-world scenarios.

This benchmark does not claim to be academic or to represent absolute truth; I was simply curious to compare fundamentally different approaches. That is why I included not only standard comparisons like virtual functions vs. CRTP, but also deeply nested virtual calls that deliberately stress the instruction cache and branch predictor.

The project is still a work in progress. Living in Ukraine, frequent power outages caused by shelling have significantly limited my available development time.

AI Disclosure: Did I use AI for this project? Yes. Benchmarks starting from #12 were suggested by an LLM, which also helped refine the AVX2 search routine and proofread my English.

You can read about Eytzinger’s binary search here: https://algorithmica.org/en/eytzinger

The benchmark results are here:
https://github.com/HarrierDuBoisX/Cpp-dispatch-benchmark/blob/main/result.md

You can find the code itself here:
https://github.com/HarrierDuBoisX/Cpp-dispatch-benchmark

https://redd.it/1xeysqy
@r_cpp
Pain of making a native GUI in cpp

So I just wanted to vent about the absolute pain of making a working gui in cpp, I am working on a scientific project to make an openFOAM gui and browse openFOAM code to add TENO schemes to it from scientific papers such as Fu et al and working through the binaries.


I have not used AI in this project because CFD is very delicate and quite frankly, AI is not ready for such complexity - especially numerical schemes such as TENO, I ended up writing the meshing, topological code and mathematics myself and by far, the hardest part was the gui coordinates and memory management. I wanted to PULL MY HAIR OUT because of managing segfaults, crashes because of a random pointer hidden inside a 2000 line function, I had to also manage internal functions of openfoam(and you know how that goes), boundary conditions, and mesh topology, it was driving me nuts. I generally regard myself as fluent in programming languages such as cpp, python, rust etc, but this is a whole nother level data management.

in the end it turned out to be a pretty good contribution to the openFOAM community, hopefully the project will mature further and I will be able to write a paper on it.

https://redd.it/1xezb1k
@r_cpp
My proposal for a cleaner text ticker / typewriter effect syntax in C++

I realized my previous error concept was flawed and that similar things already exist in C++, so I put some thought into it and came up with a cleaner, much easier wrapper.

To display text character-by-character (or in chunks of a few letters) in standard C++, you usually have to write a decent amount of boilerplate code. My goal was to eliminate all that extra writing. With this design, you only need to write a few concise lines, like in the image at the bottom.

Here is how it works:

1. **Block Configuration:** In the first line, `std::text_ticker(text_size(100))` sets up the configuration block. `text_size` defines a size limit applied to **each individual text object** inside the scope (in this case, up to 100 characters per string). If an individual text exceeds this limit, it triggers an error.
2. **Creating & Configuring Variables:** Inside the block, we create a `std::string` variable (e.g., `Home`). We assign it using `text(...)`, which defines the three core properties of the ticker:
* **Content:** The actual string in quotes (e.g., `"Home"`).
* **Step / Chunk Size:** How many characters to display at a time (e.g., `3`). For `"Home"` (4 letters), it will display the first 3 letters first, and then the remaining letter `e` next.
* **Delay (ms):** The delay between chunks in milliseconds (e.g., `400` ms, which is 0.4s).

You can also reassign a new text configuration to the same variable later on, like `Home = text("Hello", 1, 800);`, which instantly updates its content, chunk step, and timing properties.

Currently, I'm thinking about the best way to handle the actual execution/triggering of the print loop (maybe using memory addresses, unique IDs, or custom stream operators).

std::text_ticker(text_size(100))
{
std::string Home = text("Home", 3, 400);
Home = text("Hello", 1, 800 )
}


We can see things like range-based `for` loops here. For some people, that's already a piece of cake, but I think my way might be a bit different or easier for anyone who prefers this style. There will be more features added soon, like changing the text color for specific strings.

I'm not claiming this is the ultimate standard, because I know similar tools and range-based loops already exist, but I'm just trying something out to see if people find it useful or neat.

If you agree with me or like the idea, feel free to drop a positive comment or an upvote!

What do you think about this approach to keeping text animation syntax short and clean?

https://redd.it/1xexwwr
@r_cpp
Is "Democracy" Best For A 40 Year Old Language With Over 16 Million Users?

I've been researching what "consensus" means in the C++ committee, and it seems there are two definitions that are similar, but I suspect result in different languages. In the first definition, you count hands on a poll, and if it clears the bar it moves forward. SD-4 says a proposal normally advances when more than twice as many are in favor as against:

https://isocpp.org/std/standing-documents/sd-4-wg21-practices-and-procedures

In the second definition, the chair looks for the largest piece of the design that nobody has a sustained objection to, moves that forward, and keeps working on the rest. (Disclosure: I'm involved in some of the contracts papers).

What is different with these definitions? A poll tally picks among the designs as written, so the one with the most hands wins, even if a third of the room is strongly against it. The second definition might pick something else, which is the biggest subset everyone can live with. For example, EWG forwarded contracts (P2900) at 25/17/0/3/12. That's 42 for, 15 against, and 12 of those strongly against. Under the first reading of consensus that's a clear pass. Under the second, the question becomes what part of it those 12 could accept, and whether the rest should wait. Am I wrong that these ship different things?

The culture of WG21 for as far back as I can tell has used the first definition. A poll count determines the design. There's another word that describes this: "Democracy."

The ISO wording seems to lean toward the second definition of consensus. Clause 2.5.7 defines consensus as "general agreement, characterized by the absence of sustained opposition to substantial issues by any important part of the concerned interests and by a process that involves seeking to take into account the views of all parties concerned and to reconcile any conflicting arguments."

https://www.iso.org/sites/directives/current/consolidated/

It says this "need not imply unanimity" and that sustained opposition "is not akin to a right to veto", so I don't read it as a one-person blockade. ISO's own guide for participants says "decisions within working groups are consistently reached through consensus, meaning there are no formal votes involved".

https://www.iso.org/files/live/sites/isoorg/files/store/en/PUB100037.pdf

Its convenor toolkit says the convenor "is responsible to determine when consensus is reached":

https://www.iso.org/files/live/sites/isoorg/files/store/en/PUB100416.pdf

I couldn't find a ratio for working groups anywhere in the Directives, and the 2:1 looks like a WG21 addition. Is a straw poll a "formal vote"? Maybe not, but is it consensus? Should it be?

Every ISO working group runs under that same text, so I'm curious how the other groups interpret it. I've heard secondhand that some deliberate the objections until they're resolved instead of counting. I can't verify that, and I'd love corrections from people who attend those other groups. The sibling group WG14 (C) publishes its minutes, and it uses straw polls too, so the answer clearly isn't simply "no polls". However, C does not seem to be evolving large features the way that WG21 does.

In March 2026, WG14 polled pieces of one proposal separately:

https://www.open-std.org/jtc1/sc22/WG14/www/docs/n3954.htm

A universal function pointer type got 21-2-2, the predefined macros got 6-9-6 against, and the integer typedefs got 10-2-11. That looks to me like finding the part people agree with, but I wasn't there and can't say for sure. If you're interested in the bigger picture, comparing how different ISO groups handle strong objections seems like a worthwhile research project.

Why might
it matter more for C++? It's over 40 years old, and adding is easy while removing is nearly impossible. A committee paper called `vector<bool>` a mistake in 2007 and it's still there. Releases come every three years, so a deferred piece gets another shot soon, while a shipped one is permanent. The fair counterpoints are that the chair's call is hidden power, "the largest thing everyone accepts" could be watered down, and RFC7282 admits one intransigent person can "stop the process cold":

https://www.rfc-editor.org/rfc/rfc7282.html

The frequency of contested features is going up over time, as the committee grows in size and faces significant challenges such as memory safety and evolution (networking when?) In my opinion, if we use democracy to design C++, then there will be a growing divide between the winners of the vote and the losers of the vote, creating adverse social consequences.

Would it be better for the language if we prioritize general agreement over majority rule?

https://redd.it/1xfbr4o
@r_cpp
Need a new laptop recommendation

Hi,

I used to write C and C++ programs a lot in university. I moved into data science after university and have mostly be working with Python, SQL and docker. Now I would like to go back into C and C++. I am buying a new laptop and I am confused between Macbook air 15 or any of the Linux laptops. I have used Linux solely for the last 6 months and noticed that when I am not working and need to use the laptop for normal things like making CVs, working on PDFs, even using bluetooth, the desktop environments are either not stable or the functionalities in apps are not enough.

I dont know if this is a common issue or just me. But I need a new laptop now and want to make sure i make the right choice for low level programming. Which of the 2 should I get?

I appreciate all opinions. Thanks!

https://redd.it/1xfuev5
@r_cpp
New C++ Conference Videos Released This Month - October 2026 (Updated To Include Videos Released 2026-10-19 - 2026-10-25)

C++Day

2026-10-19 - 2026-10-25

C++26 Execution Control: An Introduction (Alberto Barbati) - [https://www.youtube.com/watch?v=U4b8yO5L5JY](https://www.youtube.com/watch?v=U4b8yO5L5JY)
Interesting Allocators in Games (Sergei Kushnirenko) - https://www.youtube.com/watch?v=6fWwaLMgC94
From legacy code to a registry of modern algorithms (Roberta Cisotti) - [https://www.youtube.com/watch?v=u\_FZatqHFAk](https://www.youtube.com/watch?v=u_FZatqHFAk)
Zero-Overhead Dispatch: Leveraging __musttail and Custom ABI in C++ - https://www.youtube.com/watch?v=2N7ALplaMC4&pp=0gcJCTAMAYcqIYzv

C++Now

2026-10-19 - 2026-10-25

C++ Magic Statics Demystified - History, Internals, Pitfalls, and Optimizations - Chandranath Bhattacharyya - [https://youtu.be/kV6TbuRMIVg](https://youtu.be/kV6TbuRMIVg)
Code C++ Like a Library Author - Jon Kalb - https://youtu.be/LgTEvW61J70
CMake’s Recent Evolution - Modules, CPS, and Build Optimization - Bill Hoffman - [https://youtu.be/aas2DSxHrT8](https://youtu.be/aas2DSxHrT8)

2026-10-12 - 2026-10-18

Implementing Logic in C++ - Hans de Nivelle - https://youtu.be/3ffgtI31iKw
The Secret to C++ Reflection Now: CMake Code Generation - Bret Brown - [https://youtu.be/OW\_h9oyHQ-0](https://youtu.be/OW_h9oyHQ-0)
Co-Designing Integrated AI-Enabled Compiler-Runtime Systems - Hartmut Kaiser - https://youtu.be/cIt4D\_SJcI8

2026-10-05 - 2026-10-11

Signal Trees - A Deep Dive into a High-Performance Alternative to Queue-Based Task Scheduling - Michael Maniscalco - [https://youtu.be/ZRd\_XN3LGxo](https://youtu.be/ZRd_XN3LGxo)
Object Oriented Programming in Contemporary C++ - Steve Downey - https://youtu.be/m7gwSr27m74
Cutting Some Slack for our Programs - Lisa Lippincott - [https://youtu.be/xwnRPyRK5h4](https://youtu.be/xwnRPyRK5h4)

2026-09-28 - 2026-10-04

What Every C++ Programmer Needs to Know About AI - Jody Hagins - https://youtu.be/ZBXHPKVCa8E
SPL - Open Source, Constexpr Library for Composing Algorithms - John Bandela - [https://youtu.be/96AGjm3uwko](https://youtu.be/96AGjm3uwko)
Senders For Existing Asynchronous Interfaces - Dietmar Kühl - https://youtu.be/KB5Nfofgu2k

ACCU

2026-10-19 - 2026-10-25

Serial C++ Can Be Parallel Too - Eran Gilad - [https://youtu.be/4amZ\_ZWqpA8](https://youtu.be/4amZ_ZWqpA8)
C++ Magic Statics Demystified - History, Internals, Pitfalls, and Optimizations - Kathleen Baker & Chandranath Bhattacharyya - https://youtu.be/h40xp211BCw
What static, inline, const, constexpr Mean and When to Use Them - Andreas Fertig - [https://youtu.be/u8te1UQOxQY](https://youtu.be/u8te1UQOxQY)

2026-10-12 - 2026-10-18

Dependency Injection and Dependency Inversion - C++ Perspective - Vladimir Vishnevskii - https://youtu.be/hzD9k4BZCE4
AI Writes All Your Code Now - How Will You Ever Debug It? - Greg Law & Mark Williamson - [https://youtu.be/-hTG9Jp\_2PU](https://youtu.be/-hTG9Jp_2PU)
The Not-So-Hidden Corners of C++ ABI Stability - Luis Caro Campos - https://youtu.be/3nd4RIH5okA

2026-10-05 - 2026-10-11

Real-time Safety in C & C++ - Guaranteed by the Compiler! - Anders Schau Knatten - [https://youtu.be/FeYEO3PhEVY](https://youtu.be/FeYEO3PhEVY)
Modernizing Legacy Codebases Without Stopping the World - Peter Muldoon - https://youtu.be/w9k-L0GLLKM
Our Journey Toward a Fully Backward-Compatible, UB-Safe, ISO C++ - John Lakos - [https://youtu.be/whFzmXXhG5g](https://youtu.be/whFzmXXhG5g)

2026-09-28 - 2026-10-04

Refactoring Towards Structured Concurrency - Roi Barkan -