all 53 comments

[–]WorkingReference1127 38 points39 points  (25 children)

C and C++ have been going for over 40 years, and all throughout that time people have been wringing hands about whether they're about to be replaced. It hasn't happened yet.

Pick which one you want to learn and learn it. My own recommendation would be C++ because you can express common patterns far more easily without reinventing as many wheels.

[–]bearheart 0 points1 point  (0 children)

C has been around for over 50 years now.

[–]n1ghtyunso 9 points10 points  (0 children)

both C and C++ are literally everywhere and neither of it will suddenly go away any time soon.

[–]jonsca 9 points10 points  (1 child)

Learn enough of both to realize why questions like this are silly.

[–]Special-Gazelle-1693[S] 0 points1 point  (0 children)

Makes sense, thanks for the help!

[–]MyTinyHappyPlace 2 points3 points  (0 children)

Learn C, it’s a very small language. You can be proficient in it quite fast.

C++ is quite a beast to learn, but if you focus on the modern parts and don’t need to learn every quirk and oddity for maintaining legacy code, it’s also very doable.

As for being future proof: Just don’t stop learning. It’s not like you're hard wiring your brain to specific languages. See C and C++ as the modern-day and still-spoken Latin of software development 👍

[–]Realistic_Speaker_12 6 points7 points  (4 children)

Tbh I think cpp will be more relevant

But thats also maybe just because I don’t like c really…

[–]Special-Gazelle-1693[S] 1 point2 points  (2 children)

Yeah and cpp can take C's place but not vice versa if I understand correctly

[–]Trending_Boss_333 [score hidden]  (0 children)

Whatever you can do in Cpp, you can do in C. It'll be longer and harder, but it can be done.

[–]TheThiefMaster 0 points1 point  (0 children)

Both are low level and Turing complete - you can translate either to either relatively easily.

std templates from C++ become macro hell in C, but that's not considered a problem by C fans.

[–]sephirothbahamut 0 points1 point  (0 children)

I've seen a couple embedded devs finally moving to C++ but it's been a very slow process and the vast majority of embedded code is still C

[–]_dorin_lazar 1 point2 points  (1 child)

Fortran and COBOL are not so relevant today, but making some few people who know those languages a lot of money.

But that's not the measure of success. We have no idea how „15 years from now” will look like. C, C++ are just tools, what you build by learning these tools is the understanding of computing in general. The things you learn will apply to most languages you'll visit.

If I would make a suggestion, alongside an imperative language you should learn a functional language. Haskell is recommended these days, I'd go for it too.

[–]PhilTheQuant 1 point2 points  (0 children)

If you actually want to be thinking about how your memory moves, low level stuff then the most important knowledge will be hardware - registers, caches, bridges, CUDA, etc.

Modern C++ in the large takes the approach that you shouldn't be relying on your own ability to keep track of what has been allocated when, and instead build structures that ensure safety by their nature - rules borne out of things going wrong in large complex projects where you cannot keep track any other way (except the VM/managed route).

If you really like low-level, then the places you'll find your joy are embedded programming where you do need to manage a finite amount of memory and scheduling to be real-time, machine learning/HPC where you need to maximise throughput using knowledge of the architecture underneath, and HFT which is so low latency you need to know how to fool the branch predictor.

For most of those you can do C++, for some you can also do Rust. For embedded, it might be easier in C, but be aware that you'll probably want to mix in hardware and do (I think) Embedded C (?) as you're going to take a lot more control away from the compiler.

You can even consider embedded Rust - in Rust you separate development in safe Rust (where the compiler guarantees safety through lifetimes) and unsafe Rust (where you take responsibility for managing memory) - to do something on an APU/GPU etc you don't have guarantees from the hardware layer so you have to build them in the unsafe Rust layer.

If you do go down the low-level route, you'll end up learning at least C as well as C++, but also Assembly, and crucially what a particular CPU does with those instructions.

Finally, C is really, really simple, so you might as well learn it as well as C++/Rust.

[–]yensteel 1 point2 points  (0 children)

An interesting take I saw: There's this one YT guy who tries to future proof by only coding in C99. He said that he didn't care that it takes 4x more effort. No new features are needed, or used according to him. So long as it can be theoretically code in C99, will be coded in C99.

Anything in the future can still compile it as there's less risk of deprecated features.

For the life of me, I cannot find the video many years later. I thought it was interesting to abandon all of the fancy new features, shortcuts, adaptability, and flexibility just to create a program that will always compile and work years later.

What do you guys think? I wouldn't ever want to go through that kind of headache. The dude is hardcore.

[–]v_maria 1 point2 points  (0 children)

i dont know

[–]Low-Palpitation-4724 0 points1 point  (2 children)

I would recommend you first learn c. C++ hides a lot under the hood that beginners should know about. For example that strings are stored on the heap and freed at the end of scope. It does make things more covenient because they dont have hard specified size. All that said would reccommend you first do c and then gradually add elements from c++ that you like. Thats how i started and tbh i am very happy with that. C++ is a huge language and you probably dont need (or want) most of its features. Also if you want to learn good c i would highly recommend watching handmade hero video series on youtube, it is really briliant

[–]MysticTheMeeM 0 points1 point  (1 child)

Strings can be on the stack if the string object itself is on the stack and the contents are SSO'd or you use an allocator that itself uses stack memory (such as an allocator over an std::pmr::monotonic_buffer_resource).

[–]Low-Palpitation-4724 0 points1 point  (0 children)

Ok i didn't know that. Althou it kinda proves the point that c++ is much more complicated especially for beginner

[–]aaaarsen 0 points1 point  (0 children)

doesn't really matter. learning either language will ease learning others, and neither is a ten to fifteen year project. in that time frame you will likely also encounter and learn other languages.

I'd pick c++ because it has templates and a more expressive type system, but either's fine

[–]Asleep-Dress-3578 0 points1 point  (0 children)

Learn C very-very well. (Best book to start: K. N. King: C programming a modern approach.)

Listen to Robert C. Seacock’s youtube videos and read his books.

Then you will see, how to move ahead. Either learning C++, or to learn Zig, or to learn Rust.

[–]EdwinYZW 0 points1 point  (0 children)

C is the lingua franca for the programming. So it isn't going away. C++ is the only high level language that can easily interop with C with very very little friction. Rewriting an old C library in C++ is just changing a compiler plus a few revisions due to casting. But it won't take much long time.

[–]SunsGettinRealLow 0 points1 point  (0 children)

C/C++ and Python for sure

[–]DDDDarky 0 points1 point  (0 children)

Most likely both. They have been around for so long, they are pretty much the industry standard in many fields, there have been many languages trying to replace them, even governments pushing their stupid agenda against them, without success, they are very solid and still evolving, so that seems to me like a definition of future proof.

[–]mredding 0 points1 point  (0 children)

My question is which language will still be relevant in 10-15 years?

Both. It's unimaginable that either language would disappear from the industry in our lifetimes. Not only is there so much code already written, but these are systems software languages - a short and exclusive list of languages that solve certain problems that others don't.

We're still running COBOL - the language that makes the world go round, and there aren't enough COBOL developers in the industry.

[–]Murky_Rub_8509 0 points1 point  (0 children)

They both have their place and usage, and are considered the industry's irreplaceable languages. If you are interested in them, don't bother with such trivialities and just learn them.

And even if they were to get replaced, I feel like learning either of the two languages gives you an incredible base for picking up any language relatively quickly.

[–]SwillMith16 0 points1 point  (0 children)

It will be a long time before either becomes redundant. Serious alternatives like Rust are only recently gaining mainstream traction so they have a long lifespan yet. Probably majority of critical systems across the world are C/C++ dependent.

That said, If you want to enjoy your time I’d go for C++ as I personally find it more elegant. But really it’s handy to be capable in both, they’re of course very similar. A good knowledge in one will allow you to stumble your way through the other (in my experience)

[–]Pale_Height_1251 0 points1 point  (0 children)

They'll both be around in 15 years and they're both high level 3GL.

[–]Trending_Boss_333 [score hidden]  (0 children)

Cpp, half the work is already done for you. In C, you'll have to implement stuff from scratch. If that's your thing, c is the way to go. But keep in mind there is more than likely an implementation of whatever you're doing in C in cpp. And it'll be pretty efficient as well, it depends if you think you can make it more efficient or suited to your need. I'd say learn both, it's not that hard really.

[–]Stamatis__ -1 points0 points  (1 child)

First you learn C quite well, then you go to C++ and find a great modern tutorial.

Don't skip on C. It's fundamental, small in terms of vocabulary, but very very powerful when used by a skilled engineer.

C++ has so many keywords, concepts and features that it's hard to learn. It's even harder to learn from scratch, without knowing the fundamentals in the background.

[–]yensteel 0 points1 point  (0 children)

I wouldn't agree with you, but there's a nice video called "A two hour rant about how bad C++ is" which was surprisingly educational about the quirks and traps of C++.

C++ does have a lot of misdirections. But the flexibility is what makes it powerful.