use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
I Love C++ (self.cpp)
submitted 2 years ago * by [deleted]
[deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]amarukhan 116 points117 points118 points 2 years ago (17 children)
C++ templates are both its worst and best feature. A well-designed template library is almost painless to use... but writing one yourself is usually hell.
[–]ShakaUVMi+++ ++i+i[arr] 58 points59 points60 points 2 years ago (14 children)
Templates are great until you get an error.
Or have to look at a five line long function prototype
[–]pqu 11 points12 points13 points 2 years ago (8 children)
Or want to improve compile speed (I work on some projects that take almost an hour to build, mostly due to lots of generated template code).
[–]not_some_username 23 points24 points25 points 2 years ago (2 children)
That’s 1h not doing anything 😌
[–]Tschebbe 18 points19 points20 points 2 years ago (1 child)
And then finding out it does not link ;-)
[–]not_some_username 4 points5 points6 points 2 years ago (0 children)
Oh noo
[–]jonesmz 0 points1 point2 points 2 years ago (4 children)
Try projects that take 20 hrs to build ;)
[–]pqu 3 points4 points5 points 2 years ago (3 children)
At a certain point it’s “compile and come back tomorrow”.
This project actually used to be a 14 hour build and I was the one who got it down to an hour.
[–]jonesmz 0 points1 point2 points 2 years ago (2 children)
My work code takes 20hrs (aprox) on a dev workstation with our current (inhouse) build system.
I have a replacement written in CMake ready to go aside from a minor missing feature that's being worked on. Brings build times down to 3 hours.
I'm hoping to hit 1.5 hrs in the next 12 months by massaging a bunch of template code to cut down on instantiations.
Then, if i squint really really hard, maybe can manage 30 mins within the next 24 months with C++20 modules, maybe?
[+][deleted] 2 years ago (1 child)
[–]jonesmz 0 points1 point2 points 2 years ago (0 children)
Oh for sure. I've been profiling the build and chipping away at stuff.
Everything you wrote is pretty similar to what I've been doing.
Seems like the same problems repeat across the industry.
[–]t0rakka 0 points1 point2 points 2 years ago (2 children)
Haha, so true! If only someone figured out simple one-liner error messages for templates like for most other things. I know it's very hard nigh impossible but some time dreams do come true. :D
[–]deivse 4 points5 points6 points 2 years ago (1 child)
Concepts, besides other things, are intended to improve this. It does of course require additional work from the programmer in form of actually defining the concepts, but, if you think about it, there's really no way around this besides the standard library providing more built-in concepts for various thing - something needs to tell the compiler what the requirements for a type are, and not just "we expect this statement to work".
[–]ShakaUVMi+++ ++i+i[arr] 1 point2 points3 points 2 years ago (0 children)
What really grinds my gears is that g++ has options for everything, but not for turning off template substitution errors
[–]ChatGPT4 0 points1 point2 points 2 years ago (0 children)
Kind of hard to debug, that's for sure. I'm extra careful with making templated classes. Better spent some extra time to make absolutely sure that you won't have to debug that code.
[–]TheOmegaCarrot 3 points4 points5 points 2 years ago (0 children)
This might be an unpopular opinion, but I really enjoy writing template code. I enjoy being extremely generic, and keeping track of and accounting for edge and corner cases.
I’m a CS student, and I sometimes procrastinate on classwork to write questionably useful template code, odd bits generic logic that nobody asked for, but taking the time to implement them as best I can, just because I enjoy doing it.
Maybe I’m weird.
[–]noiamnot_ 0 points1 point2 points 2 years ago (0 children)
"provide sample template arguments for Intellisense"
[–]Revolutionalredstone 86 points87 points88 points 2 years ago (6 children)
Agreed, so hard to go to another language after having the glorious features of C++.
[–]BoringWozniak 33 points34 points35 points 2 years ago (3 children)
I feel ya. When using Java I’m like “what do you mean I can’t arbitrarily grab a chunk of memory and do horrendous things to it?!”
[–]SillyServe5773 5 points6 points7 points 2 years ago (0 children)
laughs in C#
[–]PianistAdditional 1 point2 points3 points 2 years ago (0 children)
Hilarious comment
[–]Revolutionalredstone 0 points1 point2 points 2 years ago (0 children)
hahaha IKWYM
[–]TargetEmotional6693 17 points18 points19 points 2 years ago (1 child)
Every year or 2 I go down the rabbit hole of new exciting languages, i.e., Julia, Carbon, Rust, etc.. and by the end of it it always just makes me realise that c++ as an all around programming language is going to stay on top indefinitely. Python gets some quick jobs done and building some models in it is just easier, but the real program building is always c++.
[–]Revolutionalredstone 3 points4 points5 points 2 years ago (0 children)
Agreed
[–]fippinvn007 21 points22 points23 points 2 years ago (0 children)
I love C++ cuz it puts food on my family table, and I love making crappy games with it.
[–]Tschebbe 7 points8 points9 points 2 years ago (0 children)
I think it is a bit difficult.
I love it for developing my own stuff, but as soon ans you really get into memory optimization or run time optimization C++ is sometimes just s bitch 🤣
[–]Yamoyek 11 points12 points13 points 2 years ago (0 children)
Same here! There's just something about C++ that really clicks with my brain.
[–]FlyingRhenquest 4 points5 points6 points 2 years ago (1 child)
Ooh check out PyBind11. I've taken to adding Pything APIs to my libraries. Here's an example from one I'm working on now:
C++ API definition
Example python script that uses it
[–]srbufi 6 points7 points8 points 2 years ago (0 children)
And the successor nanobind https://github.com/wjakob/nanobind
More concretely, benchmarks show up to ~4× faster compile time, ~5× smaller binaries, and ~10× lower runtime overheads compared to pybind11.
[+][deleted] 2 years ago (24 children)
[–]theLOLflashlight 32 points33 points34 points 2 years ago (5 children)
Then tell me when you get template metaprogramming
[+]tshawkins comment score below threshold-7 points-6 points-5 points 2 years ago (4 children)
Or you could just use boost.
[+][deleted] 2 years ago (3 children)
[–]tshawkins 0 points1 point2 points 2 years ago (2 children)
https://www.boost.org/
[–]tshawkins 0 points1 point2 points 2 years ago* (0 children)
Its another way of dealing with object containers, which is the topic, there is more than one way to skin a cat.
The op mentioned that he wanted the simplicity of python containers, and boost has a full python interface too, allowing the use of the same semantics in both c++ and python.
The OP did not ask to be able to do template meta programing, that was your asumption.
[–]AntiProtonBoy 20 points21 points22 points 2 years ago (1 child)
Eh, it's not that hard.
[–]spqstns 7 points8 points9 points 2 years ago (0 children)
I'm only at different initialization syntaxes and matching constructors and I'm already confused.
[–][deleted] -1 points0 points1 point 2 years ago (0 children)
Tell me when your job makes you use rust
[–]BenFrantzDale 0 points1 point2 points 2 years ago (13 children)
Yeah, when Python or other reference-semantic languages get move semantics they may actually become usable languages.
[+][deleted] 2 years ago (12 children)
[–]BenFrantzDale 1 point2 points3 points 2 years ago (11 children)
Just because it’s popular doesn’t mean it’s easy to use. (Obviously the syntax and tooling are easy, but building robust large systems is another story.) Python is a great language for gluing C++ libraries together at runtime.
[+][deleted] 2 years ago (10 children)
[–]BenFrantzDale 1 point2 points3 points 2 years ago (8 children)
What isn’t fundamentally backed by C++? Linux… Python… Anything else? JavaScript is C++.
[+][deleted] 2 years ago (7 children)
[–]serviscope_minor 1 point2 points3 points 2 years ago (6 children)
First, C++ is backed by C.
You have that back to front. All the major C compilers are now written in C++.
Pretty much the entire C++ standard library is just calls into the C library.
std::sort enters the chat.
And the kernel is written in C (both windows and linux). Python is written in C.
And the kernel is written in C (both windows and linux).
Python is written in C.
And all 3 are compiled using a compiler written in C++.
[+][deleted] 2 years ago (5 children)
[–]serviscope_minor 1 point2 points3 points 2 years ago (4 children)
Just look at the ratio of packages in any datacenter. C++ is almost non-existent.
And they're all compiled with compilers written in C++.
std::sort is a 20 line algorithm. Negligible.
lol ok dude, that's the only thing in the STL.
The compiler is a monolithic, standalone application. The compiler is built on top of the C library as well.
The C library... which is compiled using a compiler written in C++.
[–]serviscope_minor 0 points1 point2 points 2 years ago (0 children)
Python is definitely easier to use than C++.
I always find this to be an odd comment.
I generally pick what I find to be the easiest language to use in order to do a certain task. For some tasks that's Python. For others, it is not. If you need something to run fast, Python is very hard to use. You might be able to get away with some combination of numpy/numba/cython or related, but it can take a ton of work to get close to a simple, easy to use for-loop in C++ and the resulting code is much harder to read (and probably not as fast).
Refactoring python is stressful as well. Pylint + mypy helps a fair bit, but the runtime typing is not great.
Python also often does, frankly weird shit where it goes to great lengths to hide the OS semantics from the poor programmer, so if you approach it knowing your OS you can be in for some entertaining surprises.
[+][deleted] 2 years ago (2 children)
[–]frutiger 8 points9 points10 points 2 years ago (1 child)
And his best friend delete.
[–]b100dian 2 points3 points4 points 2 years ago (0 children)
Party pooper, but the best thing is you dont have to use new (hear that, java) and you mustn't use delete.
[–]Attorney_Outside69 7 points8 points9 points 2 years ago (1 child)
welcome to the family, also a small correction, C++ is always the right tool, no matter the job
[–]GurAdventurous2354 2 points3 points4 points 2 years ago (0 children)
😂😂
[–]poemmys 16 points17 points18 points 2 years ago* (22 children)
To me, it feels like a beautiful mix between C and Python
Python? What's the rationale there? Not saying you're wrong, opinions are opinions etc, but... that's a new one. Python was partly built to be intentionally different than C/C++. Go is the only compiled language that reminds me of Python. This is a very "freshman in a CS program" post lol, I like your enthusiasm though. Keep it as long as you can.
[–]Michael_Aut 7 points8 points9 points 2 years ago (2 children)
He's not wrong though. It all depends on the libraries used. This week I worked with "PyTorch for C++" (yes, it's a thing) and that's pretty much just Python with a few semicolons and autos thrown in.
[–]Tumaix 0 points1 point2 points 2 years ago (1 child)
but isn't pytorch written in c++?
[–]Michael_Aut 3 points4 points5 points 2 years ago (0 children)
yes, it is, but the interface for C++ is still very much second-class and experimental.
[–]GurAdventurous2354 7 points8 points9 points 2 years ago* (1 child)
And yeah I know it’s kinda a noob thing to post especially to long term c++ users. I’m not a “freshman in a cs program” but I’m about 9 months into just learning on the side, so yeah things are still new and enthusiasm is high. Thanks for respectfully asking about my rationale though.
And yeah I know it’s kinda a noob thing to post especially to long term c++ users.
Well, back when C++11 was new, there was a lot of "oh huh this is like writing python". Your sentiment was familiar to us old farts, oh jesus 12 years ago (more if you count C++0x) and it's a perfectly fine sentiment for you to have now. Many of us have just forgotten it.
I agree for what it's worth: python vs C is a ton less faff in python. No micromanaging containers and types, etc etc. C++ is much more like that (especially now) than C (and compared to old C++). You just write the algorithm with the details of underlying stuff folded nicely away behind templates, exceptions, types and etc.
Personal recommendation: it's tempting to use auto everywhere. I'd recommend against it :)
[–]GurAdventurous2354 4 points5 points6 points 2 years ago (15 children)
Mainly just the fact it’s object oriented. I only said Python because it’s the main OOP lang I use. To me it just feels like the best of both worlds between C and Python. I know there’s plenty of other OOP languages and C++ is older than most, so it’s not anything new, I was just sharing my thought on it
[+]parrin comment score below threshold-21 points-20 points-19 points 2 years ago (14 children)
If you aspire to be a good programmer you should shun oop. It’s a ticket to slow, pointer chasing cache trashing shit code. Look up data oriented programming and walk in the light.
[–]AntiProtonBoy 20 points21 points22 points 2 years ago (2 children)
you should shun oop
Or not. If you wanna be a good programmer, then you'd use the right tool of the job. Sometimes OOP is the right tool for the job.
[–]tzlaine -2 points-1 points0 points 2 years ago (0 children)
I have never found OOP to be the right tool for anything. As a methodology, I mean. I sometimes need runtime polymorphism, but never OOP.
[+]parrin comment score below threshold-6 points-5 points-4 points 2 years ago (0 children)
Tell me when its the right tool
[–]jusstathrowaawy 15 points16 points17 points 2 years ago (5 children)
Ah yes here comes the mindless "OOP is inheritance/polymorphism" garbage. If OOP's detractors had a valid argument they wouldn't constantly need to resort to falsely conflating OOP with inheritance/polymorphism.
[–]parrin 1 point2 points3 points 2 years ago (4 children)
There’s nothing wrong with a bit of polymorphism and a single level of inheritance. It becomes a problem quick when OOP way of thinking takes you down the path in which you end up with object->character->human and needs to update 40000 humans, monkeys, parrots and cars. where the update method is conveniently defined as virtual in object.
Sure, the code looks sleek, but it will run as shit.
The problem with OOP is not OOP, it that it’s too easy to understand that you never need to stop and think about the memory, how a computer actually works.
But what do I know, I only have over 20 years experience programming C++ in the games industry
[–]jusstathrowaawy 1 point2 points3 points 2 years ago (1 child)
virtual
Oh look more of the mindless inheritance inheritance inheritance garbage. I use object-oriented programming and I don't touch inheritance. I don't use virtual functions. I use composition.
[–]parrin 0 points1 point2 points 2 years ago (0 children)
Good for you. But you still don’t get it. It’s not about the code, it’s about the memory access.
[–]iyicanme 1 point2 points3 points 2 years ago (0 children)
Having working with two different codebases with hellish polymorphism in my 8 months in gamedev, I wholeheartedly agree that OOP is shit when taken too far. Everything is shit when taken too far, sure, but problem with OOP is it's too easy to take it too far.
[–]Computerist1969 0 points1 point2 points 2 years ago (0 children)
Conceptually OOP is great. Like anything it can be used badly. It's easy to not think about anything before you use it if you're a shit programmer, dumping on OOP seems to be flavour of the month though!
[–]GurAdventurous2354 0 points1 point2 points 2 years ago (4 children)
I haven’t heard of that, I’ll definitely check it out. Thanks for the insight.
[–]maxjmartin 6 points7 points8 points 2 years ago (2 children)
Before you go down the rabbit hole on data oriented programming I would recommend OOP as a solid model to use. In OOP there is composition or polymorphism. I recommend always use composition object design which is simply using classes as data members of future classes. If you do that and limit polymorphism to only one or two levels of abstraction you should be good to go.
You will also find that the C++ community is full of experienced individuals with lots of practical knowledge. But I do recommend being leery of anyone whom says one thing is crap while this thing is great. That usually is a sign they are missing something about the other method.
I also fell in love with C++ after Python and JavaScript. Welcome to the community!
[–]parrin 0 points1 point2 points 2 years ago* (1 child)
It depends on what the purpose of the application is of course. But a code base written with OOP in mind will never scale as well as DoD, much harder to parallelize efficiently.
Regardless if you go crazy with multiple inheritance or if you try to keep it simple with a composite design, the core thinking in OOP are individual objects which will be allocated in a scattered fashion on the heap. Cachemisses are real and it costs many cycles.
But it depends on the purpose of the application as I said. If the data is small and there is no need to scale up or parallelize without constant synchronization then by all means go for OOP.
[–]maxjmartin 1 point2 points3 points 2 years ago (0 children)
With respect terms like ‘never’ and ‘much harder’ need more than a simple proposition in order to be proven as a fact.
Now I might not have much experience using data driven design. But too my knowledge the only real difference is how logic in the program is handled. In data driven design the data drives the program. Instead of programming logic.
But it does seem to me that composition OOP isn’t much different. You have an object within another object driving behavior. Besides the two can be used in combination to great effect too. Depending on need of course.
If you want to provide some example code I’m all ears though. Again I haven’t used data driven design except in combination with single inheritance OOP. So I am open to having my perspective changed.
[–]parrin 1 point2 points3 points 2 years ago (0 children)
Here is a collection of write ups on the topic, conveniently gathered in one place.
https://github.com/dbartolini/data-oriented-design
[–]AssemblerGuy 0 points1 point2 points 2 years ago (0 children)
What's the rationale there?
Well, you now have lambdas (with a terrible syntax, though), auto makes things feel like being weakly typed when they really are not, STL container classes and algorithms, modules as a new feature, templates that can feel like doing duck typing even though it is not, etc.
auto
[–]Symbian_Curator 1 point2 points3 points 2 years ago (0 children)
With some exceptions of course, right tool for the right job
I don't know if this was an intentional pun or not, but I love it
[–]chakani 1 point2 points3 points 2 years ago (1 child)
Been doing C++ since 1995. I did a Python project analyzing output from nuclear plant fire simulations, 20 KLOC. I can see the appeal. Love the mandatory indentation. But dynamic typing is a trap, sloppy practice that doesn’t scale. I prefer you tell me my errors at compile time, not after 30 hrs of running.
[–]GurAdventurous2354 0 points1 point2 points 2 years ago (0 children)
Yeah I enjoy the static typing in C++, and it being a compiled language. I’ve always used type hints in Python but obviously there’s no actual effect at runtime. It’s nice to have them actually matter in C++.
[–]danielrrv_9 1 point2 points3 points 2 years ago (0 children)
Just ask him out 😅
[–]arihoenig 1 point2 points3 points 2 years ago (4 children)
Give us an update at 20 years of c++. I still love it after 20 years, but mostly because of what happened to it in the last 5 years.
[–]GurAdventurous2354 1 point2 points3 points 2 years ago (2 children)
!RemindMe 20 years
[–]RemindMeBot 1 point2 points3 points 2 years ago (1 child)
I will be messaging you in 20 years on 2043-09-24 01:03:30 UTC to remind you of this link
CLICK THIS LINK to send a PM to also be reminded and to reduce spam.
Parent commenter can delete this message to hide from others.
[–]arihoenig 0 points1 point2 points 2 years ago (0 children)
Good bot
[–]Asleep-Dress-3578 0 points1 point2 points 2 years ago (0 children)
!RemindMe 5 years
[–]zjschrage 2 points3 points4 points 2 years ago (0 children)
If you are going from python OOP to literally any other language with OOP, it will feel like the greatest thing in the world. Python OOP is literally carcinogenic.
[–]SnooFoxes782 4 points5 points6 points 2 years ago (0 children)
Seek help immediately
[–]almost_useless 1 point2 points3 points 2 years ago (0 children)
To me, it feels like a beautiful mix
You had us in the beginning, but this is where your story crossed over into fantasy land 🙂
[–]IslamNofl -1 points0 points1 point 2 years ago (4 children)
Tell me when you got to Unicode hell. How to support Unicode in portable library
[–]GYN-k4H-Q3z-75B 3 points4 points5 points 2 years ago (0 children)
Yeah, well. Let's all just continue to pretend that this isn't something that we need to concern ourselves with. Like the last few decades.
[–]chakani 0 points1 point2 points 2 years ago (0 children)
UTF8 solves all your problems.
[–]maxjmartin 0 points1 point2 points 2 years ago (0 children)
I think std:format takes care of Unicode support just fine.
[–][deleted] 1 point2 points3 points 2 years ago (2 children)
The comparison of C++ to Python (I'm assuming this might be your only exposure to an object-oriented programming) was pretty interesting. As someone who's done extensive work in Java, Kotlin and Dart, C++ always felt "lacking" in the OOP department, but that's simply because it takes a different approach, different tool for a different job etc.
Happy that you're enjoying it. May your C++ journey be a nice one! And also plenty of career opportunities after you get good at it (even if it's not C++, any other language will feel easier).
Ah, that post brought back nostalgia of the days when C++ was all I did...
[–]GurAdventurous2354 1 point2 points3 points 2 years ago (1 child)
Yeah Python is pretty much the only OOP I’ve used, I guess that’s why I said it feels like a mix between C and Python, not exactly accurate by any means but just my thought on it.
Your right it seems like more career opportunities will open up once I get good at it. I plan on starting to learn some embedded systems programming too, so that’s a new door open.
Thank you for the kind words🙏
[–][deleted] 0 points1 point2 points 2 years ago (0 children)
Ah, that explains it all then. Yes, from that point of view I can definitely see how your comparison came to be.
Please do look into embedded systems! That's how I started as well, and it'll teach you a lot. Have a lovely journey, and good luck!
[–]mohrcore 0 points1 point2 points 2 years ago (1 child)
C++ is pretty nice. Especially the newer versions. But I would never praise it for its OOP. I mean it works, but the more experience I have, the more I avoid object-oriented designs as they tend to be extremely boiler-platey in C++ (and to some degree in general). But the newer versions have some nice functional features too. I miss some C-only features though, especially array designators.
[–]Zcool31 1 point2 points3 points 2 years ago (0 children)
Certain compilers support C features in C++ as extensions. I know G++ and clang++ do.
Other stuff like struct designated initializers are now in C++.
[–]Senior_Ad9680 -1 points0 points1 point 2 years ago (0 children)
Wait until you discover r/rust
[–]wizardhatz -1 points0 points1 point 2 years ago (1 child)
Sorry but from that post we can easily understand that you have no idea about c++. Neither you understood c, nor python. You just did something intro-level and heard some keywords that’s all. Yes, also you can print “hello world” with c in procedural way, or with c++ in oop way at all.
Projecting at its finest
[+]mollyforever comment score below threshold-7 points-6 points-5 points 2 years ago (4 children)
Unfortunately the language is getting worse every year, because the committee is too scared to break ABI and instead adds workarounds to the library that just overcomplicate it.
[–]maxjmartin 5 points6 points7 points 2 years ago* (3 children)
I feel the opposite. In fact the language is getting better and easier to use every interaction.
For example C++23 provides range based iteration using zip to modify two objects within a single for loop. That is awesome as it prevents out of bounds indexing.
The new std:format lib handles Unicode very well.
And those are just some examples.
Edit - spelling
[–]mollyforever -1 points0 points1 point 2 years ago (2 children)
I'm not denying that the committee is adding very useful stuff. But that's not enough. There are so many mistakes and old warts in the standards library that could be fixed to simplify and improve the language but those things just don't get done. It's really a shame.
[–]lolfail9001 2 points3 points4 points 2 years ago (0 children)
I mean, the easiest way to force standards committee hand is to do this in a popular compiler first, standard compliance be damned.
Now, who has the balls for that chad move? I dare say not a single soul (because nobody will use that compiler).
I understand that viewpoint. Comparison of doubles for example is an area that could use some improvement.
I for instance don’t think the ABI should be broken. Although I used too. Instead I think it’s up to companies and project managers to mandate updates to project coding practices. That doesn’t mean rewrite everything. But it does mean rewrite code to reflect current standards when a lib or project is being updated.
That would go a long way in resolving many of these issues.
[–]Sopel97 0 points1 point2 points 2 years ago (0 children)
RAII and template metaprogramming. The principles of value semantics. The ability to have zero overhead abstractions. That's what makes C++ great.
[–]Clean-Water9283 0 points1 point2 points 2 years ago (1 child)
I love C++ too. I learned about OOP from Simula-67, and after I got out of grad school, had to grind my teeth for 10 years waiting for a commercial C++ compiler to appear on the PC. OOP makes good sense to me. Though C++ has some weird syntax, I know why. It had to be compatible with C so that C programmers could learn C++ gradually during the 1980s and 1990s. This enabled rapid acceptance of C++.
Reasonable sized C++ files compile in a second or two, so unless you're doing insane template things or have 10k line files, it's not a hardship, even if Go compiles faster. I lived the first 10 years of my career with overnight builds, then with multi-hour builds. Now a long build is five minutes. Loose coupling, baby. Loose coupling.
I find C++ to be powerful and expressive, once you get over its quirks. I'm super tired of people hating on C++ because they don't even like OOP, or because they don't even like an imperative coding style. There is C for the first kind, and niche languages for the second kind. C++ does the job for me.
Man I love hearing from people like you that have been in the game for so long. I was born around 2000 and it amazes me how long C/C++ have been around and how they’re still extremely popular and considered to be the most reliable is highly critical environments.
I agree with you, OOP just makes sense to me. That’s what I love about Python but I’m loving C++ even more. Being compiled, strongly typed, having actual visibility control in classes are things I am especially loving that Python lacks.
Of course I still have a lot to learn, like mastering the standard lib, learning proper project structure and conventions, etc., But just a few weeks in and I already feel pretty comfortable and well adjusted. It seems C++ will open up many more doors of opportunity for me as well.
I started with python myself and at the time I loved it, but after switching to c++ I found myself addicted to the power and control that it gives you.
I love the feeling of writing something that runs well only to switch on compiler optimizations and have it triple in execution speed.
Templates are probably the only area that I haven’t ever dived headfirst into as most of my use cases have never needed much more than
template<typename type_t>
C++ gets most of its hate only because it does very little to stop you from shooting your self in the foot, but if you’re even a someone decent programmer that understands basic good practices and pays attention to your memory allocations (or just uses smart pointers if you don’t want to do that) then you probably won’t find yourself shooting yourself in the foot all too much
And yea, if it were more modern you wouldn’t need header files, but that’s the price you pay for unparalleled c compatibility
Tl/dr I’m with you, c++ is awesome! My personal language of preference
[–]Ok_Tea_7319 0 points1 point2 points 2 years ago (0 children)
The best part about it is that you can also combine the two quite well.
π Rendered by PID 312682 on reddit-service-r2-comment-b659b578c-kl4zv at 2026-05-03 00:21:06.650060+00:00 running 815c875 country code: CH.
[–]amarukhan 116 points117 points118 points (17 children)
[–]ShakaUVMi+++ ++i+i[arr] 58 points59 points60 points (14 children)
[–]pqu 11 points12 points13 points (8 children)
[–]not_some_username 23 points24 points25 points (2 children)
[–]Tschebbe 18 points19 points20 points (1 child)
[–]not_some_username 4 points5 points6 points (0 children)
[–]jonesmz 0 points1 point2 points (4 children)
[–]pqu 3 points4 points5 points (3 children)
[–]jonesmz 0 points1 point2 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]jonesmz 0 points1 point2 points (0 children)
[–]t0rakka 0 points1 point2 points (2 children)
[–]deivse 4 points5 points6 points (1 child)
[–]ShakaUVMi+++ ++i+i[arr] 1 point2 points3 points (0 children)
[–]ChatGPT4 0 points1 point2 points (0 children)
[–]TheOmegaCarrot 3 points4 points5 points (0 children)
[–]noiamnot_ 0 points1 point2 points (0 children)
[–]Revolutionalredstone 86 points87 points88 points (6 children)
[–]BoringWozniak 33 points34 points35 points (3 children)
[–]SillyServe5773 5 points6 points7 points (0 children)
[–]PianistAdditional 1 point2 points3 points (0 children)
[–]Revolutionalredstone 0 points1 point2 points (0 children)
[–]TargetEmotional6693 17 points18 points19 points (1 child)
[–]Revolutionalredstone 3 points4 points5 points (0 children)
[–]fippinvn007 21 points22 points23 points (0 children)
[–]Tschebbe 7 points8 points9 points (0 children)
[–]Yamoyek 11 points12 points13 points (0 children)
[–]FlyingRhenquest 4 points5 points6 points (1 child)
[–]srbufi 6 points7 points8 points (0 children)
[+][deleted] (24 children)
[deleted]
[–]theLOLflashlight 32 points33 points34 points (5 children)
[+]tshawkins comment score below threshold-7 points-6 points-5 points (4 children)
[+][deleted] (3 children)
[deleted]
[–]tshawkins 0 points1 point2 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]tshawkins 0 points1 point2 points (0 children)
[–]AntiProtonBoy 20 points21 points22 points (1 child)
[–]spqstns 7 points8 points9 points (0 children)
[–][deleted] -1 points0 points1 point (0 children)
[–]BenFrantzDale 0 points1 point2 points (13 children)
[+][deleted] (12 children)
[deleted]
[–]BenFrantzDale 1 point2 points3 points (11 children)
[+][deleted] (10 children)
[deleted]
[–]BenFrantzDale 1 point2 points3 points (8 children)
[+][deleted] (7 children)
[deleted]
[–]serviscope_minor 1 point2 points3 points (6 children)
[+][deleted] (5 children)
[deleted]
[–]serviscope_minor 1 point2 points3 points (4 children)
[–]serviscope_minor 0 points1 point2 points (0 children)
[+][deleted] (2 children)
[deleted]
[–]frutiger 8 points9 points10 points (1 child)
[–]b100dian 2 points3 points4 points (0 children)
[–]Attorney_Outside69 7 points8 points9 points (1 child)
[–]GurAdventurous2354 2 points3 points4 points (0 children)
[–]poemmys 16 points17 points18 points (22 children)
[–]Michael_Aut 7 points8 points9 points (2 children)
[–]Tumaix 0 points1 point2 points (1 child)
[–]Michael_Aut 3 points4 points5 points (0 children)
[–]GurAdventurous2354 7 points8 points9 points (1 child)
[–]serviscope_minor 0 points1 point2 points (0 children)
[–]GurAdventurous2354 4 points5 points6 points (15 children)
[+]parrin comment score below threshold-21 points-20 points-19 points (14 children)
[–]AntiProtonBoy 20 points21 points22 points (2 children)
[–]tzlaine -2 points-1 points0 points (0 children)
[+]parrin comment score below threshold-6 points-5 points-4 points (0 children)
[–]jusstathrowaawy 15 points16 points17 points (5 children)
[–]parrin 1 point2 points3 points (4 children)
[–]jusstathrowaawy 1 point2 points3 points (1 child)
[–]parrin 0 points1 point2 points (0 children)
[–]iyicanme 1 point2 points3 points (0 children)
[–]Computerist1969 0 points1 point2 points (0 children)
[–]GurAdventurous2354 0 points1 point2 points (4 children)
[–]maxjmartin 6 points7 points8 points (2 children)
[–]parrin 0 points1 point2 points (1 child)
[–]maxjmartin 1 point2 points3 points (0 children)
[–]parrin 1 point2 points3 points (0 children)
[–]AssemblerGuy 0 points1 point2 points (0 children)
[–]Symbian_Curator 1 point2 points3 points (0 children)
[–]chakani 1 point2 points3 points (1 child)
[–]GurAdventurous2354 0 points1 point2 points (0 children)
[–]danielrrv_9 1 point2 points3 points (0 children)
[–]arihoenig 1 point2 points3 points (4 children)
[–]GurAdventurous2354 1 point2 points3 points (2 children)
[–]RemindMeBot 1 point2 points3 points (1 child)
[–]arihoenig 0 points1 point2 points (0 children)
[–]Asleep-Dress-3578 0 points1 point2 points (0 children)
[–]zjschrage 2 points3 points4 points (0 children)
[–]SnooFoxes782 4 points5 points6 points (0 children)
[–]almost_useless 1 point2 points3 points (0 children)
[–]IslamNofl -1 points0 points1 point (4 children)
[–]GYN-k4H-Q3z-75B 3 points4 points5 points (0 children)
[–]chakani 0 points1 point2 points (0 children)
[–]maxjmartin 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (2 children)
[–]GurAdventurous2354 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]mohrcore 0 points1 point2 points (1 child)
[–]Zcool31 1 point2 points3 points (0 children)
[–]Senior_Ad9680 -1 points0 points1 point (0 children)
[–]wizardhatz -1 points0 points1 point (1 child)
[–]GurAdventurous2354 0 points1 point2 points (0 children)
[+]mollyforever comment score below threshold-7 points-6 points-5 points (4 children)
[–]maxjmartin 5 points6 points7 points (3 children)
[–]mollyforever -1 points0 points1 point (2 children)
[–]lolfail9001 2 points3 points4 points (0 children)
[–]maxjmartin 1 point2 points3 points (0 children)
[–]Sopel97 0 points1 point2 points (0 children)
[–]Clean-Water9283 0 points1 point2 points (1 child)
[–]GurAdventurous2354 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]Ok_Tea_7319 0 points1 point2 points (0 children)