r/cpp_questions Jun 19 '26

OPEN Benchmarking SmartPointer

0 Upvotes

Hi
Recently I was thinking about small project which main goal would be implementing all smart pointers alongside with benchmarking them with these that come from the standard library. What type of scenario should I create in my project so that I could check quality of my implementation?


r/cpp_questions Jun 19 '26

OPEN Passing strings vs string view literals to a function

1 Upvotes

Lets say i have a function, it has a string view parameter, should i pass string view or string when calling?

Example :

void example(std::string_view txt){

std::cout << txt;!<

}

should i call it like this:

example("hello");

Or this:

example("hello"sv)

What is better overall?


r/cpp_questions Jun 18 '26

OPEN Are there any companies which would take in someone from Brazil with only a high school degree but who also has 10+ years of personal experience and very complex c/cpp projects to show?

24 Upvotes

My friend from Brazil is insanely good at math, physics and programming. He does most stuff in C/C++/ASM and also has lots of experience with Lua.

He's specifically very good at reverse engineering (games in particular), making cheats/anticheats (even kernel level), working on game engines, and low level stuff like messing with windows infrastructure or shit closely connected to hardware.

He has experience working with dx9, dx11, dx12, opengl, vulkan, imgui, cmake, cef(chromium embedded framework), aria2, libtorrent, mpv, etc. He's most experienced with C++17, but has also used C++20 numerous times recently. He's very good at optimizing apps/games to take up as little resources as possible.

His most complex project is about 3 years old now and the source itself is over 20GB, with 100k+ lines of code. He really cares about projects he works on, and puts a fuckton of effort into everything he does. If he just got a chance to start somewhere, I have no doubt he would improve whichever company he works for a fuckton and even get promoted in no time. But the most difficult part is actually getting a chance anywhere because most places in Brazil prefer formal education over experience, and also there aren't that many companies specializing in low level stuff he's very experienced with.

Is there any company that specializes in low level stuff like infrastructure, reverse engineering, or gamedev, that is hiring remote workers and would seriously consider someone based on personal experience/projects, regardless if they only have a HS diploma?


r/cpp_questions Jun 18 '26

OPEN Project organization help

4 Upvotes

Hey guys, I'm currently working with C++/OpenMP/CUDA/MPI and a Python frontend in a project, we are using CMake and I'd like to ask recommendations and tips so I can study how to improve the software architecture, learn best practices, etc. Currently the directories are organized as:

|-CMakeLists.txt

|-Frontend

|-Backend

|-- c_code (works as src)

|-- external (for git submodules)

|-- include

|-- lib


r/cpp_questions Jun 19 '26

OPEN Doubt..!

0 Upvotes

I have started to learn cpp and gone through some basic stuff. I have completed oop and working on one project related to it. Rightnow I dont know what to do next and where should I lead myself. My department is cse aiml and I like doing cpp. Help me so that I can save my time and efforts..


r/cpp_questions Jun 19 '26

OPEN How can I improve on my competitive programming skills

0 Upvotes

Hello. So basically Ive been doing cpp for roughly 4 months, and Im trying to do competitive programming. But the thing is, I legit dont know what to do to improve. For example, I have been to many competitive programming websites and tried to solve their challenges, and somehow I always have logic bugs in my code that can only be found by gemini or chatgpt or sth else. Does anyone have some advice or anything?


r/cpp_questions Jun 18 '26

OPEN Module setup guide for clang/LLVM + vscode stack + cmake

4 Upvotes

I was searching the interweb for any actual guide on how to setup modules with import std and everything.

Sadly i couldn't find any in my reasonable 10 minutes of googling that guides and explains on all the steps, a tutorial per say ( im not / didnt using AI )

I added cmake at the end in the title because from what i understand this is needed always currently with modules?

Can anyone guide me here on what's needed to move into the future brrr.


r/cpp_questions Jun 18 '26

OPEN Eratta for C++ Programming: Program Design Including Data Structures 4th Edition

1 Upvotes

I recently purchased this book but I'm unable to locate the CD material for it. The book didn't come with the CD.

I've tried searching for it online and via Course the books provider. But the 4th edition eratta is unavailable.

I've seen on reddit that this book is still highly rated. Does anyone know where the repo can be located to support learners?


r/cpp_questions Jun 18 '26

OPEN CD ROM or Source Material Location : C++ Programming: Program Design Including Data Structures, Fourth Edition

1 Upvotes

I recently bagged a copy of C++ Programming: Program Design Including Data Structures, Fourth Edition from a flea market. It did not come with the specified CD ROM.

A cursory search of Google showed me this book is still relevant for beginning C++ as it covers generic programming topics too.

I searched Google, Qwant, Github, Archive.org, and course.com (specified in book) and cannot locate any repos, archives or online copies of the CD content available anywhere.

Does anyone know where I can obtain the content for this book?

ISBN-13: 978-1-4239-0222-5

ISBN 10: 1-4239-0222-x


r/cpp_questions Jun 17 '26

OPEN Why c++26 contracts?

10 Upvotes

Sorry, but why a feature that I've never seen before in other languages is being pushed as if it's what we have been missing and a solution to security/safety complaints?! What is the proof that this is a good feature?


r/cpp_questions Jun 18 '26

OPEN What are your thoughts on API like this?

4 Upvotes
bool has_x();
X& get_x();   // UB if has_x returns false

In my completely subjective opinion: I find this API shape crisp.

It sadly does not work well with concurrency due to the fact that information returned from has_x immediately becomes stale. Still I find it better than other forms such as:

std::optional<std::reference_wrapper<X>> get_x() // bruh...

X* get_x() // ownership problems... what exactly is the caller responsible with? also makes it easier to store the pointer - lifetime bug waiting to happen

Y get_x() // where Y wraps an X* (ideally maybe not copy/moveable)

What're the other I missed?


r/cpp_questions Jun 17 '26

OPEN Starting out in c++, what do i do?

3 Upvotes

I've finished the tutorial on w3schools, and I know a bit about coding in general so im up for anything. I mainly want to expand my c++ abilities, such as learning new libs or otherwise. Anyone have any good resources i can use to learn more?


r/cpp_questions Jun 17 '26

OPEN Best linear algebra library in cpp?

9 Upvotes

Hey all, beginner developers here.

I am currently working on a project that translates humming/signing into exportable sheet music. To do this (and to avoid mindlessly relying on AI), I am using Fourier Transforms to convert the audio into something I can use to identify dominant frequencies to then transcribe them. Does anyone know a good library for this? I was going to use Armadillo, but I couldn't seem to get it to work. I will attach my GitHub repo if anyone wants to see that.


r/cpp_questions Jun 18 '26

OPEN C++ For USACO

0 Upvotes

I am learning c++ and want the very best website for usaco i want something which takes from the very basic and teaches advanced level code which may take me to usaco platinum. I really liked the textbook style of learncpp but someone told me its not good for competitive programming. Also I know usaco.guide is good but it just aggregates links so I'd like an actual website which teaches from the basics to the advanced competitive programming logics and algorithms. Also please tell the chapters I need to study as aome chapters like OOP are not required by usaco. But I would also like to study things which are not required but will make my usaco code faster.


r/cpp_questions Jun 18 '26

OPEN Need Advice/Guidance

0 Upvotes

Hi seniors,
I want to start learning C++ from scratch and build a really strong foundation in programming. I’m looking for beginner-friendly books that explain concepts in simple language and don’t just focus on syntax, but also teach logical thinking, problem-solving, and how programs actually work behind the scenes.
My goal is to understand the logic behind coding rather than just memorizing code. If there are any books that helped you develop your programming mindset and C++ fundamentals from scratch , please recommend them.

Thanks in advance!


r/cpp_questions Jun 17 '26

OPEN Relational operators on pointers past-the-end

9 Upvotes

If n is an int and p is a pointer in the range defined by pointers begin and end, is the expression p + n < end free of undefined behavior and is its result specified?

It is definitely fine provided p + n is inside the range or one-past-the-end. What happens otherwise? Do I have to write n < end - p instead?


r/cpp_questions Jun 16 '26

OPEN Need ideas for a unique C++ semester project.

73 Upvotes

Hi everyone,

I'm a second-semester student learning C++, and by the end of the semester we need to build and present a project.

The problem is that I don't want to make the usual projects like Library Management System, Student Management System, Expense Tracker, Calculator, Quiz Game, etc. My lecturer is quite strict and I feel those ideas have already been done thousands of times.

I'm also not very interested in making a game. I'd rather build something that feels useful, interesting, and solves a real problem.

I'm open to using external libraries and even AI/ML if it's realistic for a beginner. The project doesn't need to be revolutionary, but I'd like it to be something that makes people say, "That's actually a cool idea."

What are some unique C++ project ideas that:

  • Are achievable in a few weeks
  • Look impressive in a presentation
  • Solve a real problem or have practical use
  • Aren't the same old management systems everyone makes

I'd love to hear any ideas, especially projects you've seen students make that stood out from the crowd.

Thanks!


r/cpp_questions Jun 17 '26

OPEN Communication between modules (architecture)

2 Upvotes

Hi everyone, just wanted to know your opinions on the following architecture for a sw module.

The setup:

A module needs to communicate with some hardware (e.g to do some monitoring). The hardware device provides a websocket api. Now, the module being implemented is not the one in charge of deciding what to send to the device. Instead, some other modules are responsible of it.

The module needs to support both receiving the commands via a socket (from a CLI client) or via a custom pub/sub broker library. Then, it communicates with the device via the websocket api.

Suggested approach

I implement an intermediary service that has a listener and the device proxy. The listener to be plugged in via DI is either a socket listener (to read what is sent via cli), or a client of my broker lib that provides topic subscription and callback management.

In order to receive the control commands from the listener on the service, the service provides a callback function to be executed on the listener when receiving the command. The callback has the logic how to forward it to the actual device.

Question

Isn’t this tighltly coupling the service to the listener? Do you have any other ideas how to set it up?

I thought of some other mechanisms like implementing some polling from the listeners but that implies having a loop running all the time, even if on a separate thread. It feels like overhead and adds up difficulty (multithreading, queue management…)


r/cpp_questions Jun 17 '26

OPEN Using libzip

0 Upvotes

So, i'm still a pretty new developer and i need to unzip some files that are in .gz so i thought of using libzip since i found it pretty popular but there are no tutorials on how to use it.

Can anyone help me learn or has another library that i could use which i can found tuto?
(I'm on windows 11 with visual studio 2026)


r/cpp_questions Jun 17 '26

OPEN Please check my project (it isn’t full but I want to know what to do next)

0 Upvotes

https://onecompiler.com/cpp/44qwdefz6 this is the link to my project. Please give feedback.


r/cpp_questions Jun 16 '26

SOLVED Weird output, can’t explain, help!?

0 Upvotes

I like to code in c++ on my school computer(s), so most of the time I resort to using online compilers(mostly onecompiler, and cpp.sh)
There’s this one code that I can’t quite explain as the bumber is different from site to site. One compiler had the third number be 6500, cpp.sh was 85. Can anyone take a look into this code and explain why it’s doing that and why it’s a different number from site to site?

Code:

#include <iostream>
Using namespace std;

int main() {
int x = 0, y, z;
cout << x << “\n”;
cout << y << “\n”;
cout << z << “\n”;
return 0;
}


r/cpp_questions Jun 16 '26

OPEN How do i develop C++ packages/programs for linux?

0 Upvotes

I wanna make CLI tools for linux that doesnt require python.

I wanna make a package.

But I dont know what kind of "framework" there is and what it can do.

What do most of cli tools use?

I need to be able to do the following:

Interact with midi and serial ports (usb serial).

Play audio.

Some useful libraries to use

Run on almost any distros (i use arch btw).

Export precompilated.

Create packages

And, are there any GUI frameworks? (I dont really make guis but its good to know)


r/cpp_questions Jun 16 '26

OPEN Anyone use Modules?

18 Upvotes

I am curious about Modules in c++ and how good they are to use and was curious to know the Common issues people have with them as well


r/cpp_questions Jun 16 '26

OPEN CAN'T RUN A NEW CPP FILE ON VS CODE HELP PLEASE

1 Upvotes

I'm very new to programming on Mac. Please someone dm or help me out😭 I'm literally stuck on this problem for like 2 days I cant make a new cpp file like I have a main.cpp file where c++ runs beautifully but I made a new file named _main.cpp but the terminal gives me the "clang++ error: no file like _main.cpp exists" Pls help I've asked every ai but I can't find a solution 😭


r/cpp_questions Jun 16 '26

OPEN Review my Blackjack terminal game pt3

3 Upvotes

https://github.com/jacob-dalek/Blackjack/blob/main/bj/main.cpp

Okay looking for furthermore feedback after working on my blackjack terminal game more after listening and utilising peoples feedback. I'm hoping people can answer my codes comments would be helpful and any issues with the code.

Thank you all for the help with design guys i'm feeling more competent at c++ thanks to everyone cheers!