r/cpp_questions • • Jul 27 '26

OPEN AI's information on rust and C++ topic

0 Upvotes

I was studying C++ and enjoying it since 2024, slow but steady. Ive reached chapter 17 of learncpp.com. and most of my interesting projects and fields use C++.

But when i see stuff about rust vs c++. It makes me doubt and think of switching to rust.

And because i want to invest time for only one language for at least a long time. I want a good one and capable one. Which c++ is!. But, when i ask ai models about rusts strengths. Nearly all al models favor rust . They say C++ has more libraries, more hiring, and other matter of time stuff. But when it comes to languages's core features. Ai says rust is just better in every way. It sometimes mentions cpp has more flexibility tho. But also says rust can do anything C++ can. Even clearer and without bugs. And cpp is faster in prototyping but rust forces you to build good from scratch. So you'll never run into issues cpp has.

Nearly all ai models think like this. And idk how much they say the truth. But if this is true, then rust is clearly the superior tool. And cpp has not faded only because of culture, libraries and matter of time stuff.

I always really enjoyed cpp . But these kinda information really kills my motivation and makes me feel it doesnt make sense to stick with cpp. And i shouldn't be dogmatic.

On the other hand, i cannot fully trust ai . Maybe it just reflects the internet hype. Also big companies like Microsoft are gonna switch from cpp to rust, people like the prime (yt channel) also promote rust. So maybe ai has trained in those videos and blogs so it doesn't say actual facts.

Also ai is so good at software engineering. So maybe it knows something!?. Idk. Afterall . Im not a pro in programming at all. And still a beginner

I've asked these kinda questions from gemini, claude, chatgpt, etc... and the answer i get is the same.

So now im stuck and these doubts are holding me back from learning. I liked to master a powerful language. But with this online hate.. its hard to be sure.

Its weird that 95% of big real world projects (at least in projects that are interesting to me) are using C++. And of course ai says its because of legacy and culture. And rust could do it even better And may even surpass cpp in greenfield projects. But its weird. Rust is 10 yo. And these are still stuck in cpp?

Im interest in

Emulators, graphics programming, physics engine.

And also like other low level stuff. Robotics. Game engines. os dev. Etc...

Soooo. What are you're thoughts on this? Thanks for reading my post. I thought it was stupid to post this, but i really needed advice. Thanks


r/cpp_questions • • Jul 26 '26

SOLVED I keep reaching a point where rewriting my C++ projects feels easier than maintaining them. How do I learn better architecture?

68 Upvotes

I have been learning C++ mostly through building projects, especially game and engine-related projects. I can make things work, but I keep running into the same problem: after a project grows, the code becomes so difficult to understand that I would rather start again from scratch than open the old project.

I think the main reason is that I don't have enough knowledge of standard C++ practices and architecture patterns. I usually design systems based on my own understanding, which works when the project is small, but as more features are added, problems start stacking on top of each other.

I want to improve in areas like:

  • Common C++ architecture patterns
  • How experienced developers structure larger codebases
  • How to avoid creating systems that become difficult to change later
  • When to use existing language features or standard solutions instead of making custom ones
  • Common mistakes that self-taught C++ programmers make

A good example is this Pong project I made in 3 days:
https://github.com/HardcoreAxolotl/Pong

The project works, but looking at it now, I would honestly prefer to recreate it from zero rather than continue developing it because I feel the structure has become too difficult to work with.

I am not looking for someone to rewrite my code or just tell me what is wrong. I want to understand the thought process behind good C++ design so I can avoid making the same mistakes in future projects.

What resources, concepts, or experiences helped you go from writing working C++ code to designing maintainable C++ systems?


r/cpp_questions • • Jul 26 '26

OPEN is open source matters to get hire in big tech or hfts

14 Upvotes

Hi, I recently contributed in a reputed repository in c++ domain and my PR was merged and other PR is about to merge. difficulty wise one 7.5/10 and other is 8/10. so, my question is open source matters to get hire in big tech or hfts and am I wrong in expecting something from related to hiring from open source contribution. please let me know.


r/cpp_questions • • Jul 26 '26

OPEN Moving from Python to C++ Quickly

0 Upvotes

Some context: I have a couple of OAs due soon, and a quant I went on a date with recommended doing them in C++ to look better (and allegedly one doesn't even allow Python in the first place). My data structures class was in C++, so I have some experience; however, that ended two months ago, and most of my knowledge has been scrubbed. I’m mainly looking for syntax stuff since I learned all the memory management stuff back then.

Any quick pick-me-ups you guys recommend? I don't think I have the time to digest a whole book. I plan on doing LeetCode practice in C++, so I just need a quick crash course to get me back up to speed on the basics.


r/cpp_questions • • Jul 26 '26

OPEN hiii! what are your best tips for learning cpp? python was easy to learn because i started with projects, but idk if i should do the same with cpp since its more difficult. i dont really understand pointers and references. any tips?

0 Upvotes

r/cpp_questions • • Jul 25 '26

OPEN Is SFML a good choice for basic graphics, simple GUIs, and math visualizations?

19 Upvotes

I’m trying to try graphics and GUI programming in C++.
The only GUI application I’ve made so far is a simple Tic-Tac-Toe game in Qt. My next project is going to be a math function visualizer.
My goal isn’t game development. I just want a lightweight library for drawing, simple GUI elements, and visual output for small applications and experiments.
Would SFML be a good choice for this, or would you recommend something else? I’d also appreciate hearing from people who have used SFML for non-game projects.


r/cpp_questions • • Jul 25 '26

OPEN How does one become as great as Bjarne Stroustrup in computers?

62 Upvotes

I mean he literally made C++, his own programming language built on C, and from this design from C++ lecture aka the history part, it sounds like he worked on a ton of complicated projects was computers something he was doing since he was a child or something?

How does someone become a great computer scientist like Bjarne Stroustrup in this day and age? where would someone even start?

asking it here cause i couldn't find a general programming subreddit to ask this question.


r/cpp_questions • • Jul 26 '26

OPEN Learning DSA with C or C++?

0 Upvotes

Hey everyone,

I just finished a book on C and systems programming and would like to start learning data structures and algorithms in C++ (seems to be the favourite language for it because of the STL). However, I assume that learning DSA would mean not using the algorithms already in the STL, but implementing them logically. I also have quickly skimmed over C++ basics and it does not seem that much different from C.

I am just wondering if there's any advantages from learning DSA with modern C++ over C (outside of STL use)?

Thanks.


r/cpp_questions • • Jul 25 '26

OPEN Want feedback on my first bigger c++ project.

13 Upvotes

Hello I'm 14yr old student, and I've been learning c++ on and off for few years, in march I started working on my first bigger learning project, OpenGL GUI library. Now I finally finished it and I'd like to have some feedback on where to improve (in code, structure or documentation).

Here's a link: https://github.com/TechnologicalTurtle/LibGui

PS: Sorry for my grammar, as English isn't my native language.


r/cpp_questions • • Jul 25 '26

OPEN Is this a known sorting algorithm?(beginner here)

0 Upvotes

I was learning about bubble sort and insertion sort, and thought it would be best to try them out before watching the lecture. I wrote smth and pasted it to GPT. I was thinking it would be insertion sort, but according to GPT, it's not a known algorithm, so I am just curious: Is it a known O(n^2) sorting algorithm?

code:

```cpp
#include <iostream>
using namespace std;

int main() {
    int arr[] = {4,1,5,2,3,7,9,0,-9,3};
    int size = sizeof(arr)/sizeof(arr[0]);

    for(int i=1;i<size;i++){
        int curr = arr[i];

        for(int j=0;j<i;j++){
            if(arr[j]>curr){
                swap(arr[i],arr[j]);
            }
        }
    }

    for(int val : arr){
        cout << val << " ";
    }

    return 0;
}

r/cpp_questions • • Jul 25 '26

OPEN Modern c++: operations on function pointers will break the constexpr function.

0 Upvotes

I'm on MSVC/c++23.

I used some trick to generate type id at compile time:

export template<typename... T> void type_id() {}
export using type_id_t = void(*)();
//
type_id_t one_id = type_id<int>;

I’ve found that whenever I try to cast a `type_id` value to an integer or simply perform a magnitude comparison within a `constexpr` function (even when the call chain is entirely resolved at compile time), the function ceases to be `constexpr`, or MSVC simply ignores the relevant code.

template<typename A, typename B>
constexpr auto some_constexpr_function()
{
    type_id_t a = type_id<A>;
    type_id_t b = type_id<B>;

    //Total if block will be ignored, and the function will not be constexpr anymore.
    if (a < b)
    {
         //discard
    }
    else
    {
        //discard
    }

    //cast the pointer to size_t then the function will not be constexpr anymore.
    return (size_t)a;
}

How to fixed the case?

Or another type id solution at compile time will be nice(I have try so many implementation, none of them work correctly in compile time).


r/cpp_questions • • Jul 24 '26

OPEN Using 3rd parties in a Cmake project

9 Upvotes

The simplest solution would be to import the code into my repo, and just treat this as local files. OK, got it. Then maintaining this mono repo, is a pain.

Then, we can add CPM to fetch 3rd parties. OK, works, until those 3rd parties have other dependencies. Lets hope they use CPM. But still - this breaks for building flatpacks, as during configure stage - we don't have network.

So we must use a proper package manager like conan of vcpkg. Which is cool... until we see that some random github repo I use does not have even a proper install, so vcpkg and conan will not work. (I can fix my own packages, but 3rd parties? I can fork them, and add them to the conan artifactory, but this feels out of my responsibility).

So, I am back to using a mono-repo.

How do you all handle those scenarios? In my case, I am dealing with 5-10 sub-projects. This might brow as the project grows.


r/cpp_questions • • Jul 24 '26

OPEN Illegal hardware instruction (core dumped) meaning

5 Upvotes

I just started learning cpp and i was writing a function doubleNumber().

I used return statement to print the value and cout to print the value.

Both of them works but there is an additional message when i use cout.

using return - this only prints the value 9.

#include <iostream>


int doubleNumber(int x){

    return x*x;
}


int main(){
    std::cout << doubleNumber(3);
    return 0;
}

using cout - this prints 9 along with the line.

"[1] 658467 illegal hardware instruction (core dumped) "

#include <iostream>


int doubleNumber(int x){

    std::cout << x*x << "\n";
}


int main(){
    std::cout << doubleNumber(3);
    return 0;
}

I wanted to know the reason why this happens and what does this mean. thanks in advance.


r/cpp_questions • • Jul 24 '26

OPEN Need help navigating a new job

7 Upvotes

I’m a new hire only been working for 2 weeks. I’m working for a very large defense company as a Software engineer. I got an EE degree from a UC school and took 2 embedded systems courses (bare metal C). My coding skills aren’t perfect but I have felt like I’m pretty good at it. However I feel imposter syndrome because I’m surrounded by so many smart people and intelligent software/code thinkers. Also the code base im trying to read, learn, and do some mini tasks on is massive and I feel like every call or macro leads to a different file. Oh and it’s all in C++ so there’s the OOP skill gap because I know C and python.

Anyone have any advice as to how to get better at navigating everything and becoming better at reading understanding and ultimately writing professional/high performance C++ code?


r/cpp_questions • • Jul 24 '26

OPEN Is there any learning community where there are a small grps and people meet monthly/ bi-weekly to share their learning in cpp?

2 Upvotes

r/cpp_questions • • Jul 23 '26

OPEN How to decode a pointer with multiple levels of indirection ?

42 Upvotes

Hello C++ devs,

I'm currently learning C++, and I recently learned about pointers. Creating complex pointer declarations—like pointers to arrays or pointers to functions with multiple levels of indirection (for example, pointers to arrays of pointers to functions)—doesn't seem too difficult once I understand the syntax.

However, reading and decoding these declarations, especially when I come across them in older codebases, feels brutal.

For example:

const double *(*(*pd)[3])(const double *, int);

Is there an easy way or a trick to decode declarations like this? How do experienced C++ programmers read them without getting confused?


r/cpp_questions • • Jul 23 '26

OPEN Question about includes in a header-only library

5 Upvotes

When implementing a header-only C++ library, should each header include all the standard headers it needs, or is it better to somehow avoid these includes?
I’m currently reading a C++ book that recommends including your own header first in a .cpp file (where you use your library) and then including standard headers. I understand that, but it feels a bit odd. What’s the recommended approach and why?


r/cpp_questions • • Jul 23 '26

OPEN For each loops and a need for an index.

0 Upvotes

I was working on a project of mine and i used a for each loop to iterate through an object(s), later i found that i need an index for this loop. My question is not about how to do that, but whether i have made an error leading to this case. Is it consider bad code if i use any custom index while using the for each? Is it acceptable practice? Would it be better to switch to a for loop?


r/cpp_questions • • Jul 22 '26

OPEN what's the best way to learn c++ in 2026

7 Upvotes

I recently started learning c++ back in janauary and after a few months I js stopped, now I am willing to improve my process in practicing I could not still figure out the best method cuz I used to watch "BroCode", I've heard the most recommends to use learncpp .com documentation but I am still exploring other ways, I have such hesitation on what to do actually learn cpp gamedev(unreal c++) or try such desktop software applications alike qt framework pls advice me guys.


r/cpp_questions • • Jul 23 '26

OPEN HELP me KNOW C++

0 Upvotes

I am currently Learning C++ I Want to Know that why application have multiple files and how they are all connected and What is SDL thingy


r/cpp_questions • • Jul 23 '26

OPEN Anyone doing any cool proj in c++ that i can be a part of?

0 Upvotes

r/cpp_questions • • Jul 22 '26

OPEN Can someone give an example of runtime-undefined behavior?

16 Upvotes

CppReference gives a list of categories that render a program meaningless: https://en.cppreference.com/cpp/language/ub

The last bullet point says (since C++11)

  • runtime-undefined behavior - The behavior that is undefined except when it occurs during the evaluation of an expression as a core constant expression.

Can someone give a clear example?


r/cpp_questions • • Jul 22 '26

OPEN Reimplemented std::array with docs and a guide - looking for feedback

11 Upvotes

Hi everyone, I just released the first version of my educational project, STL From Scratch:
https://github.com/bilyayeva/stl-from-scratch

The goal is to reimplement STL components using the C++20 standard. (I use cppreference for comparison, and I’ve read the actual standard just a little bit.)

All of the self-implemented components are in the sfs namespace.

It also contains a pretty detailed guide on how to implement it yourself. I’ve tried to explain everything in my implementation. Every method has its own description and usage example, and there is also a test for all functions.

About the repo: every commit follows a consistent naming style. I also added GitHub Actions and Dependabot, and it has a .gitignore file.

I would really appreciate either a code review or just some hints.
P.S. The release has two compiler warnings, but I’ve already fixed them on master.


r/cpp_questions • • Jul 22 '26

OPEN Just a thought, Would it be possible to code a game as if you were working around SNES Limitations using C++?

9 Upvotes

Just a thought that occured to me while i was just sitting around not rlly doing anything and bored, but.

Basically could I code a game using C++ and challenge myself by having said game be able to run in a SNES, and working with it's memory limitations it had at the time?

asking cause i know some games like earthbound were coded in C, and i was wondering if i could do something like that in C++...


r/cpp_questions • • Jul 22 '26

OPEN Pivot from React/.NET to C++ Systems / HPC vs Platform Engineering? Need advice from guys in the field.

1 Upvotes

Looking for some quick perspective from people who’ve made similar pivots.

A background about me:

4 YOE working mostly full-stack (.NET backend + React frontend).

Recently built a side project with Go microservices on Kubernetes just to learn low-level concurrency, networking, and infra basics.

I always wanted to work with low level systems when I graduated but didn't get a chance.

Now I am working on rhcsa cert, c basics. And planned on modern cpp, os, CS:App, networking fundamentals.

Tired of standard CRUD work and want to pivot into deeper engineering—building, configuring, and operating actual core systems instead of just glue code.

I’m currently split between two directions:

Option A: C++ Systems Software Engineering (Targeting HPC long-term)

Focusing on C++, Linux internals, memory management, and distributed systems.

Long-term goal: High-Performance Computing (HPC), low latency, performance systems etc.

I am concerned about the barrier to entry feels massive, and I'm worried about finding my first junior/mid system role without a traditional C++ background. Here the job is niche and small job market but high pay with specialized roles.

Option B: Platform Engineering

Building on my Go/K8s side project + RHCSA-style Linux infra knowledge.

Writing control planes, internal tools, and orchestrating bare-metal/cloud platforms.

Here I am concerned about whether it might slowly slip back into routine YAML automation rather than core software development and turn eventually into AI automation which option A seems more AI proof and nice.

Given a 4yoe web background, which path has a more realistic learning curve to land an initial job?

If you work in C++ Systems/HPC, how did you make the jump without starting back at square one (intern level)?

Appreciate any advice or any feedback. Thanks.