Even when you mix C++ into managed code, you might just break even instead of gaining perf, due to type-marshaling between managed and native code. But it really depends on what you want to do.
I know of a Microsoft product that is 80% C# (ui, logic, graphics), and 20% C++(video/audio codecs, processing, hardware interaction), and i think the 80/20 mix is what most people end up with when optimizing.
A rule of thumb is to only optimize what you need to - don't overdo it. Profile your app and see where the bottlenecks are, and shoot for those areas. You might not always need to switch to unmanaged code for the task, there are many ways to write bad C# (meaning that you might be able to make your C# faster).
From what I've read, it may actually be harder to write performant C++ than it is to write good C# code - that the time and effort you'll spend on perfecting the C++ code may not be worth it.
2007-02-01 06:00:08
·
answer #1
·
answered by fixedinseattle 4
·
2⤊
0⤋
Yes you have the capability to mix protected code C# with unprotected code C++ within a .Net executable. You do lose some protection from hack attacks like buffer overflows but C++ has checking for that too you can turn on.
If you're always going to be programming in a Windows environment C++ is less important but if you want to maximize your employment option stable, current, fully implemented .Net environments don't exist yet in other platforms like Unix, Linux, AIX and HPUX. In those environments C++ is the preferred solution for applications requiring high speed.
2007-02-01 13:44:09
·
answer #2
·
answered by aiguyaiguy 4
·
1⤊
0⤋
If you are going to be writing .NET applications, C++ and C# both compile to managed code (IL), executed by the CLR. If you are going to be writing things that run in native code, such as device drivers etc., you will probably need C++. For web applications, most desktop applications, enterprise systems and so on, you will probably more likely LOSE performance by trying to do optimisations yourself on the native code through C++. This may seem counterintuitive, but when you take into account the heuristics behind the CLR garbage collection and memory management, multiple cpus, multiple servers, platform changes, JIT compilation, optimisations and so on, .NET handles most of that for you behind the scenes.
2007-02-01 14:00:45
·
answer #3
·
answered by fszendzielarz 2
·
1⤊
0⤋
Depends on what you are planning to do... If you are interested in programming for games, operating systems, device drivers, and other intensive tasks, skip c#.. Go straight to C++
However, if you are doing application development, web sites, and such, then there is no need to learn c++ again.
2007-02-01 13:41:44
·
answer #4
·
answered by chaotic_n_cryptic 3
·
2⤊
0⤋
never hurts to know multiple laguages. If you do refresh your C++ skills, you can then contract out and help companies upgrade their C++ based applications to C# - and you would actually be able to read and understand the C++ code.
2007-02-01 14:24:30
·
answer #5
·
answered by Richard H 7
·
1⤊
0⤋
Yea, you should
2007-02-01 13:37:26
·
answer #6
·
answered by Anonymous
·
1⤊
1⤋