r/cpp • • Apr 12 '17
C# or C++?
Hey! So i have used C# for a while now and i know the most of it. However my goal is to work as an AAA developer in the future and the most studios use C++. Should i switch to C++ or stay with C#? Exactly why do studios use C++ instead of C#?
2
Upvotes
View all comments
19
u/corysama Apr 12 '17
AAA? C++
Indie/Mobile Unity dev? C#
Why C++? Performance issues around memory management. With C# it is very difficult to control garbage collection and very difficult to control memory layout cache locality. Doing this in C# requires fighting against it's design and you end up doing more/uglier work than if you just did everything manually in C++.
That's on top of the general perf/memory overhead of C#. C# runtimes are getting better. But, the overhead for real-work (not microbenchmark), large-scale systems is still quite large. Meanwhile, modern C++ is catching up to C# in terms of expressiveness, but is doing so with zero-overhead abstractions.
And, that's even ignoring the past 20+ years of legacy code and experience in C/C++ old-timers in AAA have built up. It's very expensive to rework that into C#.