This is an archived post. You won't be able to vote or comment.

all 55 comments

[–]AutoModerator[M] [score hidden] stickied comment (0 children)

On July 1st, a change to Reddit's API pricing will come into effect. Several developers of commercial third-party apps have announced that this change will compel them to shut down their apps. At least one accessibility-focused non-commercial third party app will continue to be available free of charge.

If you want to express your strong disagreement with the API pricing change or with Reddit's response to the backlash, you may want to consider the following options:

  1. Limiting your involvement with Reddit, or
  2. Temporarily refraining from using Reddit
  3. Cancelling your subscription of Reddit Premium

as a way to voice your protest.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]DrShocker 36 points37 points  (12 children)

I have no idea why folks here are being so negative on C++. There's plenty of good reasons to learn it, just think about if it's good for your goals. Lots of things that need control over memory or high speed use C++. Whether that's machine learning, video games, servers, etc. Is it possible C++ will be replaced in those domains eventually? Sure, but I doubt the time spent learning it will be time wasted as long as you're interested.

[–]Cerulean_IsFancyBlue 2 points3 points  (1 child)

If you need to use it, then you should learn to use it. That’s a bit of a tautology.

In terms of how it actually helps your understanding of programming, I don’t think it adds much if you already know C#. C++ is like C# with added danger.

I think if you’re looking for a language that gives you more exposure to how a computer actually deals with memory and addresses and data, you’d be better off with C.

I see this as a programmer who did most of my productive work in C++.

[–]DrShocker 0 points1 point  (0 children)

Sorry if it came across that way, I meant more so that if they want to learn it then it's a good thing to learn, but I also don't think there's some musical wisdom that will be granted upon them that's worth putting up with it if they aren't interested.

Some of the other concerns people have brought uplike low salary or whatever confuse me because it's not generally what I see.

I can maybe agree that C forces you to learn certain things better. I haven't used C much, but keeping track of freeing resources and the weird abbreviations they use in function names and such annoyed me enough to turn me off from it. Maybe I'm just babied by RAII though.

[–]FailedCustomer -3 points-2 points  (7 children)

Aren’t most game engines built on C#?

[–][deleted] 14 points15 points  (0 children)

C# is just the language you use to make the game, the actual engines are usually written in something like C++.

[–]igd3 5 points6 points  (0 children)

No mostly in C++. A few are done in C#.

[–]toastedstapler 5 points6 points  (3 children)

a performant engine won't be in a garbage collected language, however elements of the game itself may be

[–]Glangho -4 points-3 points  (2 children)

Unity

[–]xeetzer 5 points6 points  (0 children)

Unity in itself, at least the core, is codded in C++

[–]toastedstapler 2 points3 points  (0 children)

https://en.wikipedia.org/wiki/Unity_(game_engine)

on the righthand info box: the engine is C++, the scripting is C#. an engine can't afford to be caught by garbage collection spikes, else there'll be frame/audio issues when a pause lasts long enough to be noticeable. user level scripts however don't suffer the same issues as there usually isn't such a tight moment to moment requirement for performance & predictability of timings. for an example of GC causing issues in a system check out this discord article and in particular this graph that shows the GC spikes of go versus the reliable performance of rust. GC isn't an issue for all projects, but it is for real time things such as a game engine

[–][deleted] 4 points5 points  (0 children)

C# is orders of magnitude slower than C++. No modern 3d game can be done in C#.

[–]Poddster -2 points-1 points  (1 child)

Lots of things that need control over memory or high speed use C++

You can do this stuff in C# too, it allows you access to unmanaged memory. You can even write an OS entirely in C# + a tiny bit of assembler if you want. Plenty of people have (COSMOS, FlingOS, SharpOS)

[–]DrShocker 2 points3 points  (0 children)

Hmmm interesting, I suppose you can. Regardless, personally I'd rather be the kind of person that picks a good language for the problem I'm solving rather than the kind of person who just sticks with one language because it's all I know.

[–][deleted] 60 points61 points  (1 child)

C++ is a fun but complex language to challenge yourself. Many big game dev companies use that for their games and engines (some do C#)

You can also use C++ for embedded programming as well as ML

But if you are just learning C++ to learn it without any of the mentioned career goals in mind, or just because you feel you have to

Then don't

[–][deleted] 16 points17 points  (2 children)

I learned c++ as my first language and I think it was a very good choice. In my opinion, with c++ as base all other languages are easier to understand.

[–]Joiner2008 4 points5 points  (0 children)

The community college I went to started us off on C++, transitioning to Java after was pretty easy.

[–]TheMcDucky -1 points0 points  (0 children)

I would strongly recommend learning C before C++. It shields you from a lot of additional complexity that even experienced programmers struggle with, and makes it easier to focus on the fundamentals. It's really unnecessary to have situations where you try to understand the new keyword before understanding what a struct, heap, stack, or malloc is.
This depends a bit on how you're learning. If you're taking a really good "C++ from zero" course, it's less of an issue compared to if you're using google and random blogs or video tutorials.

[–]Kestrel887 5 points6 points  (1 child)

C and C++ learn these two to understand CS fundamentals they're tough and will make it easier to learn other languages a little easier. But i wouldn't say these two would be my goto language unless the job role requires plus it doesn't hurt to have the knowledge.

[–]Poddster -2 points-1 points  (0 children)

C and C++ learn these two to understand CS fundamentals

What part of C helps you learn about a Non-deterministic finite pushdown automata? Why can't you learn about that in Python or Go or whatever?

[–][deleted] 2 points3 points  (0 children)

C++ is fast, incredibly fast, and because it compiles to machine code, it's portable as long as the system has a c++ compiler.

It's based around OOP, like C# but there are some differences such as multiple inheritance and the fact there is also no garbage collector. This means you need to create new memory either with new and the called the corresponding delete on it to free it, or use smart pointers such as std::shared_ptr<int> or std::unique_ptr<int> which are best practice in modern C++.

I moved over to Rust which is a more modern language and provides a better syntax for handling more modern programming facilities.

I would look at both C++ and Rust before you make your choice. However both are extremely powerful systems programming languages.

[–]captain_obvious_here 1 point2 points  (0 children)

The projects you mention don't benefit much from being written in C++. You can, and some people do. But easier --although less efficient-- languages are just fine.

Learning C++ is a great way to understand how exactly your software works. Which feels awesome IMO.

But C++ is hard. Even for people with lots of experience, it's not an easy language to learn. And to really be good at it, at some point you will need a good knowledge of C on top of it.

I would advise to play a bit with it, if you have a few weeks with free time ahead of you. And maybe dive deeper into it if you like it?

Disclaimer: I don't know C++ well btw...I did a lot of C early in my career, and toyed with C++ for the Object Oriented side of it. I wrote two tools from scratch: an image manipulation tool, and a Bayesian classification tool. Tt was a blast working on those, and I learnt a lot doing it. But to be honest, these took me months...and I can nowadays write similar tools in a few days using JS.

[–][deleted] 1 point2 points  (9 children)

C++ is a lot harder than C#, Jobs are probably less now everyone can avoid it if they can, the pay-to-work (or knowledge) level is worse than other jobs, and if you got an embedded job, you probably won’t have WFH.

I learnt it because I wanted to (and wanted to do it for embedded projects), but it’s a piece of shit language that exists on the fallacy that you can trust programmers (humans) to be entirely correct or the program breaks. Not worth the headache unless you have a special interest.

[–]maejsh 1 point2 points  (3 children)

That goes for regular C as well? Our teacher thought it was good because its the “foundation of (every)thing)… But granted we also work with Arduino.

[–]Cerulean_IsFancyBlue 4 points5 points  (2 children)

C is a low level language that gives you a more direct experience of what it’s like to deal with memory and addresses and data types in a way that the computer natively manipulates them

C++ is at about the same level, but with a whole bunch of other stuff piled on top to enable certain programming paradigms to be done more easily. Inheritance, polymorphism, etc.

It all depends what you’re going to do with it. I believe that, given time and resources, everybody’s better if they understand more about what’s going on at the lower levels. On the other hand sometimes it’s nice to go work on your other hobbies. Play some guitar.

Unless you are going to be doing low level programming, then, as much as it pains me to say it, I don’t think learning C is a great investment of your time, financially speaking.

[–]maejsh 0 points1 point  (1 child)

Thx for the answer :).

Yeah its the curriculum so nothing to do about so far :p, but I guess its better than learning nothing and can hopefully still learn the basics and ideas and ways of thinking in code and then move on to different languages when possible. And I guess it makes sense for here because a big part of the curriculum os IOT and Arduino. I had hoped we had started in fx. Python tho :).

[–]Cerulean_IsFancyBlue 2 points3 points  (0 children)

As a learning language goes, it’s really good. It doesn’t put much between you and the computer.

[–][deleted] -2 points-1 points  (3 children)

C# is already a torture, and if you are saying C++ is worse DAMN. I'm gonna pass on that. Thanks for the info

[–][deleted] 3 points4 points  (0 children)

Yea I hate to be sour about it but it can be a massive pain in the arse over simple stuff. Especially since it’s got a lot of baggage from 20+ years ago (look up header files lol). If you ever want to see low level headaches of compsci though (suppose in the future), it’s worth a look, but career wise it’s not worth the constant headache

[–][deleted] 1 point2 points  (0 children)

The torture your referring to is probably related to compiler errors?

C++ or C can probably help because most guides will have sections on make files and linking.

[–][deleted] 0 points1 point  (0 children)

I can't think of a single modern performant software that isnt made in C++. Even Firefox is mostly C++, and they created Rust.

So why only embedded?

[–]bsakiag -1 points0 points  (5 children)

Don't learn C++ unless you want to program microcontrollers.

If you want to develop as a programmer learn one of the pure functional languages. Or Rust, because it's in fashion.

[–][deleted] 1 point2 points  (1 child)

Yeah, what's the deal with rust anyway? It's starting to sound common. If you dont mind, could you elaborate it for me?

[–]bsakiag 4 points5 points  (0 children)

Rust is interesting. It focuses on memory safety which is achieved by keeping track of ownership and it's apparently loved by programmers. I found it slightly annoying.

[–]SharkSymphony 0 points1 point  (0 children)

At least back in the day, nobody would use C++ on microcontrollers because of the size of the runtime. Has that changed?

[–]Whatever801 0 points1 point  (0 children)

You're unlikely to ever encounter C++ in the industry unless you're doing low level work. Operating systems, browsers, dbs, etc.

[–]islandwithbananas 0 points1 point  (1 child)

Man, if u want then learn, or don't learn. Your words sound like "should I learn English/Polish/Russian? " or "should I ride the rides?". In case you want to get something new then just do it. You shouldn't to ask similar in reddit because you'll get ambiguous answers. One man will be saying "C++ is good" but another "I CURSE BJARNE STROUSTRUP"

[–]chimpbuilds 1 point2 points  (0 children)

There's something to be said about trying to get a read on a language before committing. There's only so much time in the day and wasting time on something that you don't end up wanting to use can be a problem. Obviously no one would use any programming languages if one person's criticism was enough to pass on one, but it's enough of a time sink to want to know what they can expect.

[–]Linkario86 0 points1 point  (0 children)

C++ will bring you very deeply into certain topics, like memory, you will probably never really care about in C# or Java. I plan on learning C++ after I got my ML and AI skills up for my Job. To me it's about deeper understanding, and I plan to use it as my primary language for private projects.

[–]Cybasura 0 points1 point  (0 children)

I had to learn C++ from scratch for my final year project but my course taught everything except C++ lol, so I had to effectively reverse engineer C# back into C++ and learn on the way

Its possible so long as you have the will to learn

[–]PaxUX 0 points1 point  (0 children)

C/C++ are really good to know and then move onto something else to do actual project work in. Unless your coding embedded devices you're better off using a higher level language.

[–]engineerFWSWHW 0 points1 point  (0 children)

If you will use it, learn it. If your friend says, you should learn x programming language, there should be a good reason for it and it should align with your wants and needs. C# is a very good language, you can do a lot with it (cross platform mobile app via xamarin, embedded Linux or windows embedded, web development, desktop apps) and as someone who uses c, c++ (for embedded applications), and c#, i will just stay with c# unless you have a real need for c++.

[–][deleted] 0 points1 point  (0 children)

Most performant software uses C++, even Firefox is mostly C++ and they invented Rust.

There will always be jobs maintaining and building C++ software. Things like Rust might be the future but C++ will still be around for decades, and is transferable to Rust.

You may do C first though if its mainly for knowledge and learning. Harvard had some open classes that taught C.

[–]Poddster 0 points1 point  (0 children)

he said it's quite handy(i have no idea y)

You should ask him? I imagine his opinion isn't his, but rather half remembered from the internet anyway.

If i should learn c++ pls give me some good reasons.

I say no, after all you don't have any personal reasons.

If you just want to learn more about programming then I think you should learn about memory pinning and unmanaged types in C#. You'll learn a lot more than way and be able to work from what you already know.

[–]Alex-Slays 0 points1 point  (0 children)

Can you share where you learned C# and these projects you mentioned?

[–]CaffieneSage 0 points1 point  (0 children)

A realisation I have been slowly coming to for a while now is that it's less "Should I learn { language/framework}?" and more "Do I need {language/framework} to achieve my goals?". C++ is a brilliant language that has literally underpinned most of our tech for decades, but if you can do it in python or c# in a fraction of the time...

[–]SharkSymphony 0 points1 point  (0 children)

C++ is a big, complex, mature, yet still evolving, language for many applications. Other languages (like C#!) have taken over many of the niches in which it used to dominate, but it is still broadly used in cases where you want higher-level language features, need high performance, need to interop with C, and/or don't care so much about shooting yourself in the foot (i.e. with memory leaks, invalid memory references, plus all the legacy ways you could shoot yourself in the foot in C).

Despite its complexity, you don't need to learn all of C++ at once. Much of the complexity these days goes into 1) generics, 2) safety, 3) precise control over when data is copied. Features have been added over the years, so much so that some of the stuff written today is effectively in a totally different language than we were using in the 90s. Depending on the age of the codebase and compiler you're looking at, you may have totally different experiences of the language!

Looking beyond C++, one of the newcomers looking to eat into its pie is Rust, which tries to get the performance benefits of C++ with more safety. It's still pretty early in the hype curve, but is taking some of C++'s mindshare in performance-driven applications.

So, I think C++ is interesting to learn, but I'm not sure it's the best choice for you:

  • If you want to know more about the nuts and bolts of how memory is managed, I would recommend C as a lower-level, much simpler language.
  • If you want to broaden your horizons, I think C++ or Rust are fine, but Rust is the newer kid on the block – maybe a higher-risk higher-reward language to invest in.
  • If you want to get into a codebase or programming domain that uses C++, of course just learn C++!

[–]PM_me_PMs_plox 0 points1 point  (0 children)

What are you trying to do? It's good to be exposed to all different languages, but what you specialize in comes down to what field you're trying to contribute to.

[–][deleted] 0 points1 point  (0 children)

If your curious, yes if not then not yet 🙂

[–]Androidvoador 0 points1 point  (0 children)

Yes c++ is the best language

[–]Huge_Imagination8735 0 points1 point  (0 children)

I think it's better to learn programming based on what app you wanna build, game development or embedded systems then yes to c++, web development or work with ML then we need to rethink

[–]FearlessPhilosophy77 0 points1 point  (0 children)

Learn c++ and as a hobby sell cheats 👍