r/cpp_questions • • 17h ago

DISCUSSION Why C++?

0 Upvotes

C++ is a general-purpose, performance-focused programming language used across many different fields, and I'm really enjoying learning it. However, I keep seeing a lot of experienced developers criticize it heavily. Linus Torvalds famously trashed the language, even calling it a "horrible language":

"C++ is a horrible language. It's made more horrible by the fact that a lot of substandard programmers use it, to the point where it's much, much easier to generate total and utter crap with it. Quite frankly, even if the choice of C were to do nothing but keep the C++ programmers out, that in itself would be a huge reason to use C."

He basically called C++ developers idiots. Even though he made this comment years ago in 2007, to be exact, it's starting to make me doubt my choice. And it's not just Linus; other tech pioneers and plenty of people on Reddit talk negatively about C++ as well. Different people have different critiques about the language claims such as, it's memory unsafe, violates clean language design principles, and more.

So, are these critiques mostly aimed at older versions of C++, and did modern C++ (C++11 and beyond) actually fix these issues? What are your thoughts?


r/cpp_questions • • 23h ago

SOLVED Performance of std::vector

26 Upvotes

In the university we had to implement quicksort, the unsigned ints are stored in std::vector. I have accidentally discovered, that all algorithms, despite how students implemented them, are much faster when instead of directly accessing data from the vector like that:

arr[n]

we write:

unsigned int *a = arr.data()

and access that data by writing:

a[n]

But I can't understand why is that, in both cases it translates to one and the same: *(a + n)

The code is compiled on Clion IDE if that changes anything, no custom settings for compilation are used.

I can't directly share the algorithms for copyright reasons as they are not mine.


r/cpp_questions • • 5h ago

OPEN Where to start learning C++?

11 Upvotes

Hi everyone! I want to start learning C++, but I’m not sure where to begin. As my first goal, I plan to build a simple 3D viewport to understand how everything works in practice. Could you please advise on where a beginner should start?


r/cpp_questions • • 10h ago

OPEN How to learn c++ effectively and be profficient in it?

7 Upvotes

Maybe you've heard this question before, but I want to know. I've been studying c++ for a month now, and I feel like I know some of the basics, but I know that I need a different approach. I feel like I just memorize it instead of getting it. I want to learn it truly,the right way. I write a lot of code cause I know thats the best but I fall short on the thinking like a programmer part. I want to lean c++ independently,then switch to ue5 and work on a game. I would love it if you would share your methods and links to some good c++ literature. I know I'm not dumb and I know it's not easy. I am not looking for a quick solution, just the right one.


r/cpp_questions • • 17h ago

OPEN What is the best way to learn C++ for control theory implementation? Should I learn python or C++?

2 Upvotes

My background:

I'm a 5th year mechatronics engineering student that is good with matlab/simulink and is looking to expand my skills for my future career in automation/control/robotics.

I already know the basics of C++ from the course I took in college. Also, I am pretty good at 86 assembly programming. I heared that python is only used for simulations but that is what I use matlab/simulink for.


r/cpp_questions • • 11m ago

OPEN Как устанавливать сторонние библиотеки на С++?

0 Upvotes

Hi everyone! I’m learning C++ and have a question: how do you install third-party libraries? For instance, in Python, you just type `pip install` in the terminal—what’s the equivalent for C++?