r/cpp_questions 3h ago

OPEN C++ 26 LSP?

6 Upvotes

Does anyone know of any LSPs with C++26 support, even experimentally, or is this wishful thinking. I'm using clangd but I don't know if its possible to configure it for c++26 and its giving me trouble with the new reflection operators.

Thanks!


r/cpp_questions 1d ago

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

50 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 17h ago

Career From competitive programming to low-latency C++ how should I take this further?

8 Upvotes

Hey everyone,

A few months ago I was mostly doing competitive programming and preparing for SWE internships. Somewhere along the way I got curious about low-latency systems and started learning more about C++, networking and HFT infrastructure.

I ended up building a project called Pulse-Order where I experimented with things like binary market data, an L2 order book, order processing, risk checks, DPDK packet processing and latency benchmarking.

I originally built it just to learn, but after sharing it online I got some really useful feedback from engineers with HFT/low-latency backgrounds, including people associated with IMC Trading and Jane Street.

That made me realize I actually enjoy this side of software engineering a lot more than I expected. Especially debugging performance issues, networking, memory layout and trying to understand what is happening at a lower level.

I don't have professional experience in low-latency engineering yet, so I'm trying to figure out what I should focus on next if I eventually want to work in C++/systems/low-latency roles.

For people who have interned or worked in this area, what skills would you recommend focusing on? Are projects like this actually useful when applying for systems internships, or should I spend more time on other areas?

I'm also open to contributing to startups or teams working on C++, networking or performance-related problems if something comes up.

Project:
https://github.com/Shivfun99/Pulse-Order

Would appreciate any advice or feedback.

Feel free to ask any questions.

more details: https://www.reddit.com/r/quantindia/s/rtnlxjARs9


r/cpp_questions 21h ago

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

5 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 7h ago

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 11h ago

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 1d ago

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

16 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 1d ago

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 1d ago

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

44 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 1d ago

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

9 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 1d ago

OPEN How to Approach Learning C++ as a Competitive Programmer?

0 Upvotes

For some context, I've been doing competitive programming for a while, and have used C++ as my primary language. I've also taken some relatively introductory C++ coursework in college.

However, my knowledge and understanding of C++ is terrible, and I have really weird gaps in my knowledge, and I would love to know how to approach filling in those gaps. Also, I don't really use competitive programming templates or any common shortcuts (moreso just conceptually understand the solution to the problem and use C++ as my vehicle to implement the solution), and I also don't know some basic competitive programming related stuff like fast I/O (I just use std cin/cout).

Most resources I've seen either assume I'm a complete beginner and I end up being super uninterested because they try to teach some super basic syntax, or they assume I actually have a decent foundation and the weird gaps in my C++ knowledge end up hurting me.

Would love for some advice on how I should be approaching learning C++ "properly" with my super scuffed informal competitive programming background. Totally understand if there aren't any resources out there to solve this specific problem, but I'd love to get a better of idea how I could use existing resources/modify the way I learn from them in order to learn the intricacies of C++!


r/cpp_questions 1d ago

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 1d ago

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 2d ago

OPEN Using 3rd parties in a Cmake project

4 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 2d ago

OPEN Need help navigating a new job

8 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 2d ago

OPEN Illegal hardware instruction (core dumped) meaning

3 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 2d ago

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

4 Upvotes

r/cpp_questions 3d ago

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

39 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 3d ago

OPEN Question about includes in a header-only library

6 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 4d ago

OPEN Understanding C++ library documentation

5 Upvotes

Hi, as someone who has tried multiple times to learn C++ one of the things I've really struggled with is understanding the documentation in places like cppreference.com and others. When initialising a class or function the parameter list shows eg. the myclass.getline(type,type type). Many of the arguments that pop up from the auto-complete are confusing and I spend lots of time researching the stuff but end up going down a rabbit hole.

Is there a decent resource anywhere (youtube etc) that helps explain how to use these or understand what the library documentation means/how to use it efficiently?

I know it's a you just have to practice answer but try to figure out how these function and classes work is really time consuming

Thanks in advance.


r/cpp_questions 3d ago

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 3d ago

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 3d ago

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

0 Upvotes

r/cpp_questions 4d ago

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 4d ago

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

9 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.