Jump to content
  • Advertisement
Boder

C# Has C# replaced C++?

Recommended Posts

At least one popular commercial game development product uses C# as its primary development language.  Because of its popularity among independent and hobbyist developers, you will encounter a lot of C# questions and code in game developer social media.  It's sort of a selection bias. You might find most big commercial game development shops don't use these third-party tools (and don't use C#), but then again they don't hang around on social media asking about how to use their tools, either.

It's interesting to note that the products that provide a C# interface for customers are themselves written in C++.  If you want to go deeper, it's also interesting to note that the C++ runtime is itself written in C, although most modern C toolchains are written in C++.

Share this post


Link to post
Share on other sites
Advertisement
19 hours ago, Nypyren said:

This is very outdated.

That's fair. I actually worked a little bit on the team porting .NET over to Linux - it wasn't all ready for the public when I was there.

I've tried getting monodevelop to run on OSX, but was too lazy after trying to troubleshoot issues with crashes. Maybe if I tried a bit harder I could get it to run haha

5 hours ago, Gnollrunner said:

My feeling is to get to the point that it has the performance to really replace C++,

I don't believe C# will ever get to the point of beating C++ in performance, albeit the performance difference is pretty negligible for most problems right now. C# getting faster than C++ is pretty much impossible as long as C# is GCed. That being said, I don't think performance was ever the main objective, I believe C#'s main objective was to improve on C++'s faults while maintaining flexibility and usability. In other words, C# wasn't made to be fast, it was made to be easy and fun to use - which it is haha

Share this post


Link to post
Share on other sites

No, it has not replaced C++, neither in game development nor in any other programming league. Choosing any tool over any other for everything is fundamentally a mistake.

C# does not even come close to the most demanded languages in industry, which is by far JavaScript, Java and C++ in basically all technological fields. Also of note here is Google's Go and Python in engineering and scientific fields. It is a trending programming language but so is Rust (-> C++) and Kotlin (-> Java) and I highly doubt it is going to beat those on the long run.

Choose the right tool for your task, switch if nescessary. Don't hesitate. Don't be afraid.

Share this post


Link to post
Share on other sites
50 minutes ago, Lucrecious said:

 albeit the performance difference is pretty negligible for most problems right now.

You'd have to prove that to me. IMO if that was really true C# would be taking over the industry, and I don't see that happening.

Quote

C# wasn't made to be fast, it was made to be easy and fun to use - which it is haha 

"Fun" is kind of subjective. "Easy" is even kind of subjective. With C# I would probably be banging my head trying to get round the GC. But if it's working for you, then great. 

Share this post


Link to post
Share on other sites
1 minute ago, Gnollrunner said:

You'd have to prove that to me. IMO if that was really true C# would be taking over the industry, and I don't see that happening.

"Fun" is kind of subjective. "Easy" is even kind of subjective. With C# I would probably be banging my head trying to get round the GC. But if it's working for you, then great. 

I feel like this is a little bit of a dishonest take though. The reason C++ is industry standard has to do more with the dependencies on legacy C libraries and less so on performance. The reason C# isn't taking over is because it's relatively new in cross platform compatibility and probably a load of other factors.

You complaining about getting around the GC in C# is like complaining getting around dynamic variables in dynamic programming languages. Sure, you can work around them, but you'd be going against the language's design paradigm. It's not the same as me complaining about header file maintainence on C++, they're completely useless and part of C++'s design paradigm.

GC has been proven time and time again to only be negligibly slower than memory management for many problems, it's partly why Java, as much as it is annoying to code in, is so widely spread. C++ is really only needed when performance is an issue to begin with, otherwise it's not useful at all.

But anyways, this is turning into a C++ vs C# thread instead of whether or not C# will be replacing C++. I'll let you have the last word on this topic if you'd like.

Share this post


Link to post
Share on other sites
1 minute ago, Lucrecious said:

it's partly why Java, as much as it is annoying to code in, is so widely spread.

Since C# was and still is a plain Java copy from Microsoft and since both have developed in parallel nearly in the same direction during the last ten years, I wonder what you are speaking about. Syntax, functionality and philosophy wise they are basically the same with a different naming scheme. It takes a few minutes and a bit Stackoverflow to switch between both languages for a skilled programmer.

Not so easy with C++ because it has a totally different design philosophy. It's not enough to simply know a syntax, you have to think in a language. It is increadibly difficult to switch between C++ and C# mind-wise.

People switching from one language to another often complain about random things in the first days because they are still stuck in another mindset, not being able to find the same solutions for the same problems. For their own worst case scenario they dismiss it completly. Luckily it keeps being their own problem.

Share this post


Link to post
Share on other sites
1 minute ago, TMII said:

Since C# was and still is a plain Java copy from Microsoft and since both have developed in parallel nearly in the same direction during the last ten years, I wonder what you are speaking about. 

You thinking C# and Java are functionally the same is pretty simplistic, sorry. I've only heard first year university students say this. Java just by merely enforcing every class method to be virtual already requires a different programming technique.

Share this post


Link to post
Share on other sites
30 minutes ago, Lucrecious said:

You thinking C# and Java are functionally the same is pretty simplistic, sorry. I've only heard first year university students say this. Java just by merely enforcing every class method to be virtual already requires a different programming technique.

I ask you kindly to refrain from such statements in the future.

I understand this discussion got a bit heated with C#/C++ already. I am ending this discussion from my side now with a last statement that such a trivial thing is not even nearly comparable switching between any other two languages, especially from or to C++.

Share this post


Link to post
Share on other sites
2 hours ago, Lucrecious said:

I feel like this is a little bit of a dishonest take though. The reason C++ is industry standard has to do more with the dependencies on legacy C libraries and less so on performance.

"Dishonest" implies I'm lying.  I simply disagree .  For a long time Java and C# had horrible performance compared to C++. I bench marked them many times over the years.  Java in particular was pushed very hard at the department I used to work in at intel, and programmers ended up pushing back mainly because of performance issues.  It has more recently done a lot of catching up but it's still not there yet.  Same goes with C#
 

Quote

You complaining about getting around the GC in C# is like complaining getting around dynamic variables in dynamic programming languages.

I don't complain about dynamic variables in many languages that use them, because they typically don't hurt the target usage.  Requiring the use of a GC in a systems, or even applications programming language is constraint that effects how I can handle memory management and therefor can effect performance.

Quote

GC has been proven time and time again to only be negligibly slower than memory management for many problems

Proven by who? Even in C++ I rarely use the standard heap. Most of my memory management is done with a custom heap library I have built up over the years.  Most of the time I'm using some flavor of slab allocation, where new gets inlined as a free list pop. Also if I don't need thread safety for a particular heap it's turned off.  I don't think you have that level of control in C#.

Quote

C++ is really only needed when performance is an issue to begin with, otherwise it's not useful at all.

i.e. Cutting edge 3D games and other math intensive and mission critical software. It's all relative. If performance really isn't an issue we can write everything in Python.

If C# works for what you are doing then go ahead and use it.   I'm certainly not telling anyone what language they should program in. However C++ still exists because there is a need for it.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!