Reputation: 714
Can someone describe what advantages a C or C++ programmer would have over a .Net programming when developing for Windows?
Upvotes: 19
Views: 1128
Reputation: 2753
There's a saying that every sufficiently complex C application ultimately ends up reimplementing parts of C++. The same goes with C++ programs and higher languages. Learning C and C++ will indirectly make you a better programmer by helping you gain a deeper understanding of how .Net actually works, and why the designers made the choices they made.
A programmer is only as good as his understanding of the layers beneath him. .Net does a pretty good job of abstracting a lot of machine architecture issues out of view, but it's not perfect. There are still leaks in the abstraction layer where an understanding of lower-level issues will help you make good decisions at the .Net layer.
A short, incomplete list of these issues includes:
Upvotes: 29
Reputation: 40309
If you ever want to be more than a 1-trick pony, learn C and C++.
Windows will go away one day, because that's what happens to corporations and products. Perhaps we will get Skylights instead from Microsoft, and .NET is reformed into a different thing - .NEW. (whatever you want to call it).
Where is your .NET then? It's gone, as is your expertise's generality- you've become the next generation of COBOL programmer, a legacy-only programmer.
The only way to be able to stay on top of the curve is to know the principles of everything from assembly to SQL.
But that's then. What about now? You gain the ability to program triple-A games for Windows, to be able to write drivers for Windows, to be able to understand the kernel-level world of Windows, to be able to understand the details of security flaws for Windows, to be able to maintain old applications for Windows, to be able to be hired for firms that use C++.
And those reasons - IMO - are enough.
Upvotes: 0
Reputation: 57688
My understanding is .NET
is a foundation to support programming languages, and is of itself, not a language. There is Visual Basic .NET, Visual C .NET, etc.
I suggest continuing with C and C++ as you will never know when .NET
will be replaced with another technology. So far, C and C++ are slow to change and require a consortium to approve changes to the language. You could also not limit yourself and learn other useful languages such as Java, Perl, PHP and LISP. I highly suggest LISP as it is completely different than C or C++ and will enlighten you.
Upvotes: 0
Reputation: 10430
C++ is often safer because of its automatic resource management. The performance difference (in favor of C++) doesn't usually matter but memory usage actually might (GC wastes a lot of RAM).
Upvotes: -1
Reputation: 75296
If you're a .Net Windows programmer who wants to work at Google someday (aren't we all?), then it would help to learn C++.
Upvotes: 1
Reputation: 468
.NET is great for server side projects, but usage of .NET for client side code (WinForm applications or Windows services) might not be appopriate in all cases. .NET has a large runtime, occupies significant amount of memory and takes considerable time to load. Therefore if your application or service is not the primary instrument for the end user (e.g. backup software), .NET might not be the best choice.
Upvotes: 1
Reputation: 8265
C++ has better libraries for many less common tasks. Math-related, especially, where it gets big advantage from access to SSE and some other processor-specific optimizations. There are many protocols and standards based on C++, COM isn't going anywhere soon - and complex interop requires even more esoteric knowledge than just writing C++.
C++ is heading into obsoleteness, but the road will be long.
Concerning general performance - while it is possible to write faster C++ code than .NET equivalent, most C++ programs are not and a many are actually slower.
And to "understanding basics" answers... choose a language without template meta-programming for that. Please.
Upvotes: 0
Reputation: 6465
Understanding C and C++ really make you appreciate .NET more and be more careful and aware of object responsibility, memory management and performance concept. You will have more feel to what may happen under the hood when you call a method in the framework and it just does the work for yo u.
Some parallel programming to maximize the power of hardware like multicore CPU and GPU are still more restricted to lower level language like C/C++. To choose one to learn now, I will do C++. C++ is the successor of C and have more advance and modern concepts built into it. I personally learn C++ and finding that switching and work in complex C environment was pretty easy.
Upvotes: 1
Reputation: 490108
Just a few that occur to me right off:
Upvotes: 4
Reputation: 4137
Others have covered the necessity of Windows API interaction, but I also find fault with the assumption that you can guarantee (or that you'd necessarily want to be limited to) .NET development for the rest of your career.
.NET is an excellent framework, but it's very unlikely that it'll be the last. And, as good as it is, it's not the best choice for every project.
Learning the basics - and I would consider C/C++ essential basics - opens the way for any number of paths, including .NET and whatever the Next Great Framework is.
Upvotes: 2
Reputation: 3577
You might want to learn C++/CLI if you plan on doing any non-trivial interop.
Upvotes: 0
Reputation: 300549
To be honest, it's only really going to be of use when you need to access the Win32 API, but most of those signatures are available online (such as pinvoke.net), and every new version of the .NET framework includes more wrappers for commonly used Win32 API calls.
Having C/C++ knowledge is worthwhile in the bigger scheme of things, but if you are not using it everyday, you lose the knowledge quickly!
Upvotes: 3
Reputation: 15016
Although I have committed to only programming in .NET from now on, I know there will be cases where I must use interop to use third party libraries, and will likely also need to be able to dig through their code to fix bugs.
Upvotes: 3
Reputation: 887413
You should learn enough C to be comfortable with the native Windows API, as it's quite handy when writing complicated UI and when interacting with the system.
Upvotes: 9