My university did it the same way and it made me love C++.
"So convenient!" I thought, being able to use classes, and having destructors automagically deallocate resources for you. Plus getting to use strings instead of char* and vectors that we can resize at runtime. Not like those fucking C arrays.
Little did I know, pretty much every modern language is even more convenienter.
The problem isn't even that modern languages are more convenient. There is a real niche for systems languages with object-oriented features. The problem is that C++ is burdened by heavy backwards-compatibility requirements, it's unsafe by design, the ecosystem is a mess (it's so hard to link dependencies, compared to literally every other language including C and even raw assembly), and there is no consensus on style because there are so many ways to do the same thing (e.g. pointer vs reference vs rvalue reference vs smart pointer, #define vs constexpr, CRTP vs inheritance, throw exception vs return error code vs set errno, explicit cast vs implicit cast, lock_guard vs scoped_lock, #ifndef vs #pragma once, .cc vs .cpp file extension, .h vs .hpp file extension).
Some of these things are solutions from different periods (smart pointers and the things before it, ifndef and pragma once) but I think the inheritance and CRTP solve vastly different problems. And thank you for reminding me about .cc vs .cpp
Yeah I totally agree, each of these variants is different for a reason, and each one has its place. That doesn't stop them from being mixed together in weird combos and making the codebase completely unreadable lol
Do you need to learn C++ though? Do you have your eyes set on a career in it that pays better or is more interesting?
Cause I have been writing C++ as a job for a few years, and I'm going through a book on modern C++ and let me tell you, the can of worms is deep and not pleasant at all. It feels great when you get something right that you struggled for, but sometimes it's just a pain to get anything working that in another language would be trivial.
Heh fair enough, I totally get wanting to do the "difficult stuff" just for self-esteem. I'd also consider Rust - also kinda hard to grasp, but pays off a lot better when you do IMO. Good luck!
I was going to chime in and suggest rust! I’m a month in and I still don’t get lifetimes, but everything else is really starting to click and it’s so satisfying.
Stepping out of the circle jerk, C++ is a very powerful language. I've never used a language with more capable metaprogramming, and the macro system + templates can express a lot of functionality with a given amount of code.
Rust is nice, easier in general, but still a headache. I write both languages for work (different projects have different needs). Rust is more fun and has better tooling, but you can make more things work in C++ on more systems. Plus pybind11 + numpy makes working with python a dream, since you're not limited to native python.
That being said, JS and Python are both real languages, and you can solve most problems with either. Anything you can't do in them directly, you can do in C++ and wrap, and have 99% of the benefits. I wouldn't sweat it. In my experience, python is easier to wrap with than JS.
Learn C. Read the original K&R. Fire up vim and mess around with some code. C let’s you go all the way down to assembly language. UNIX was developed alongside C. UNIX is the foundational OS for everything.
C++ is another beast entirely. I’ve studied it and written code in it but it feels far too unwieldy. Java is based on a stripped down version of C++ and even it’s a handful.
Lucky you. My university still makes us use fucking C right till the end, we have to argue and fight with our profs to allow us to use C++ or Python or Java or pretty much anything other than C
Really? Oh man, that sucks. We used a bunch of stuff.
Scheme in first term to learn functional programming (and then never again)
C in second term.
C++ in both terms of second year. Plus Bash cause they were teaching us Linux. The networking class had us working mostly in the Linux terminal.
Third year had a mix. The compilers course was taught in assembly and a small subset of C (we made a basic C compiler). Operating Systems class used C (cause we were building and modifying a kernel). User interfaces was taught in Java. And the intro to AI class we could choose our language, but they strongly recommended python.
Fourth year your classes were based on your electives and what specialty you wanted to go into, but they had a wide range of languages. I took machine learning which was in python.
1.3k
u/TheShredda Jan 28 '23
In engineering we had a course on C in first year and then C++ second year. C++ definitely was.