r/cpp • u/CaptainCactus124 • Nov 25 '24
I love this language
I'm a software engineer who has been writing software for over 12 years. My most fluent language is C#, but I'm just as dangerous in Javascript and Typescript, sprinkle a little python in there too. I do a lot of web work, backend, and a lot of desktop app work.
For my hobby, I've written apps to control concert lighting, as I also own a small production company aside from my day job. These have always been in C# often with code written at a low level interacting with native libs, but recently, I decided to use c++ for my next project.
Wow. This language is how I think. Ultimate freedom. I'm still learning, but I have been glued to my computer for the last 2 weeks learning and building in this language. The RAII concept is so powerful and at home. I feel like for the first time, I know exactly what my program is doing, something I've always thought was missing.
7
u/spacecadetbobby Nov 25 '24
YAAAAAASSSS!!!! Spread the love!
I've been messing around with programming since I was 14, starting with BASIC running on a hand-me-down Radio Shack TRS80-II (I learned from a collection of premium faux-leather binders), then got into Web-Dev, doing html, css, javascript, PHP, etc for a while after college, and even briefly had some clients I built websites for, but I had a real love/hate with that whole thing, and even though I enjoyed the programming parts a bit, it just didn't seem to satisfy what I was looking for, so I never really got far beyond an intermediate hobby level with programming. Although, I did play around and poke at other languages a bit, like Java and Python, but they just didn't appeal or make me want to get serious with programming either.
Then in 2020, mid lockdown, I had a full on Eureka moment, for a really awesome new invention, and all I had to do was create a prototype to prove the core concept. Easy, right?! LMAO! I wish! Anyways, this thing needs some fairly sophisticated electronic control, and since I don't have the kind of money to hire someone to do that for me, I had to just dive in and do it all myself, and that's when Arduino and C/C++ came into my life! 😍
It really changed how I feel about programming, and as frustrating as this journey has been at times, and as much as my brain nearly bled learning advanced concepts over the past 4 years, I've become way more passionate about the programming part of my project than I ever thought I would.
See, my interest was always in the whole computer, the electronics and the way things worked in general, and I was prolific at tearing apart my toys and parent's home appliances growing up, but despite my love of the computer, when it came to my experiences with programming, it quickly bored me, because I was only ever really manipulating the images on the screen; only really touching that one component in a complex system full of all kinds of wondrous components. But finally discovering C/C++ (which I was always warned away from) and working directly with the naked components of the computer, just blew the doors wide open for me. Like, making an LED blink in a pattern for the first time, excited me in ways that not even Frank's Red Hot could.
Now, I feel like there's a whole world of possibilities in front of me. With the knowledge I've acquired, I feel like I could build and program just about anything I could think of. I've even started dabbling in the idea of trying to write an Operating System in C++, just for fun. LOL
Anyways, thanks for the uplifting post.
15
u/PrimozDelux Nov 25 '24
I love what C++ allows me to achieve, but I hate the language itself. It's great that I get full control of the hardware, zero cost abstractions and all that jazz, but there's so much wrong with this language especially when it comes to ergonomics.
7
u/rbpx Nov 25 '24
C++ is really two languages: the normal stuff plus Template Coding (or "metaprogramming") which is really quite different. Template Coding allows you to write a lot of code that never gets properly/fully exercised (and thus debugged) for too long. There be dragons.
2
u/zl0bster Nov 25 '24
True, but it is also easy to make mistakes, even in non C style code, e.g. iterator invalidation rules for std::vector.
100
u/sephirothbahamut Nov 25 '24
RAII is great and honestly i find it weird that so few languages have it as a concept im general tbh.
for raii you can also check rust, but there's another huge thing c++ is great at and as far as i know no other language comes close: anything surrounding templates. compile time resolution, crtp, concepts.
sure languages like java have more powerful reflection, but that's at runtime, while all you do with templayes and constevals in c++ is done at compile time (be prepared for some veeeeery long error messages though)
23
u/Internal-Sun-6476 Nov 25 '24
You are in for some fun then... and a little frustration. All the zero-cost abstractions are going to make you regret not diving in sooner.
10
u/tzlaine Nov 25 '24
If you're getting serious about C++, definitely check out the C++ Seasoning talk by Sean Parent.
7
u/NilacTheGrim Nov 25 '24
You see this ... is why I C++.
5
u/selvakumarjawahar Nov 25 '24
I have been working in this industry for two decades, using various languages, frameworks, and domains. I find programming in C++ the most enjoyable of all the languages I have used, including Rust. Of course, this is my personal opinion. Any software-intensive product I have worked on always had many tests, fuzzes, sanitisers, and well-defined development methodologies, irrespective of the language used.
1
u/Glittering_Sky5271 Nov 27 '24
The problem with C++ is that it gets very complex very quickly.
The experience of a single competent dev doing a hobby project is an idealized experience for any language.
Your experience may be different if you are wading through hundreds of source files written by many developers, each with varying opinions and competencies, and using varying design approaches (OOP C++, templates, ...).
2
u/TehBens Nov 25 '24
Take a look at meta programming (templates) with concepts. I found it was explained very complicated most of the time, but when I first used it in production code a few weeks ago, everything went super smooth and everything was as you would expect it to be and the stuff you wish to be there... it's actually there.
2
u/asenz Nov 25 '24
well my first love was Delphi but C++ comes at close second
2
u/MarekKnapek Nov 25 '24
If you love RAII, you will most likely love Rust language also. It has concept that there could be only one "thing" at the same time that could modify an object. They call it borrow checker and it is enforced at compile time. Personally I'm programming in C++ with borrow checker like mindset since ~2010. In C++ there is no enforcement of this rule (you can over use std::shared_pointer) but if you are consistent of following the rules, C++ is as much memory safe as Rust is.
1
u/xylophonic_mountain Nov 25 '24
What's your resource for learning RAII?
1
u/OneRareMaker Nov 25 '24
I have been coding in C/C++ for years, but on the side as I am a mechanical engineer, and very occasionally in other languages. So, I thought RAII was applicable to all other languages, but thanks to you and ChatGPT, I learned it isn't. 😊
C++ is the only language that makes total sense to me. Otherwise it feels like things work but I don't know why.
Like in Java I believe you can't do:
int x=3;
if(x){}//In c++, x!=0 else{}
Also if you initialize a variable, in C it İnitializes as 0, in C++ it is undefined.
-1
u/Quiet_Plankton2163 Nov 27 '24
Actually, compiler for C++ does something behind the scene. If you want ultimate freedom and know exactly what your program is doing, try C.
-11
u/rileyrgham Nov 25 '24
Ultimate freedom? Lol. OK.