What you can do in c++ that c# can't?

And what are the advantages today of use native code?
I think the only thing is that it's much for flexible. Imagine trying to write a driver or something in C#.

The other thing is that it's much faster. Though today computers are fasting enough to run C# and C++ at unnoticeable speeds, imagine a background application or service running on your computer, refreshing 100x per second, and having that service be written in C#.

-Blueberry
C# isn't portable.

The only alternative with C# on non-windows systems is Mono, which works fine for casual programs... but there are enough subtle differences between .net and mono that make it questionable as a crossplatform option.
@blueberry

Did you even research into these sorts of information? Driver programming in real-time applications are written in C# as well as C++.

I agree with OrionMaster. I've seen several ps3 controller drivers written in C# as well as C/++.
I'd have to say that you can do anything in c# that you can in C++. Integrating a native DLL into a c# application is quite trivial to accomplish, roughly the same idea of calling native code from Java.

http://www.codeproject.com/Articles/1392/Using-Unmanaged-code-and-assembler-in-C
You can't write device drivers that runs in kernel mode in C#. C# produces intermediate language that is interpreted by a virtual machine (.NET). All these stuff runs in user mode and WDM drivers run in kernel mode.


However, not all device drivers on Windows require kernel mode to run. The video drivers, and I believe the audio drivers, now run in user mode in both Windows Vista and Windows 7. Also there's now a User-Mode Driver Framework available from Microsoft.
http://msdn.microsoft.com/en-us/Library/Windows/Hardware/ff557565(v=vs.85).aspx
@modoran

Ultimately, even if C# does not run directly in Kernel mode it still has SYSTEM privileges and a basic access all areas pass. The special thing about Windows Kernel Space is the privileges the driver receives when loaded in Kernel memory therefore if I even get these privileges as a result of a memory corruption bug or whatever critical kernel bug it would be just as powerful as any device driver.

It really boils down to the privileges rather than space its running in.
Last edited on
Topic archived. No new replies allowed.