Visual C++ .NET vs Visual C#

Started by
23 comments, last by BKStoltman 19 years, 11 months ago
So is visual C++ more powerful or equal with or less powerfull then C#. We all know Visual C# is easier for creating windows applications. But in every situation is is just as powerful or does it lack. Or even though C++ requires more code in most cases is it still the stronger one over all. Just curious. Can Visual C# work with directX at the same level as C++.NET Every aspect. LET THE WAR BEGIN... I am curious however.
Advertisement
In Visual C++, you can compile your code to native code, which doesn''t require the .NET Framework and is usually faster. But if you want to use the .NET Classes, you have to compile to MSIL (similar to Java bytecode). In that case I don''t think it''s faster than C# anymore.

C# is not only easier for creating windows applications, but also easier for creating ANY kind of application. You don''t have to worry about memory management or other low-level programming you need in C++. It''s specifically designed to allow much easier programming.

DirectX: Microsoft has released Managed DirectX, which is a .NET Library to use DirectX in any .NET-language, including C#. Managed DirectX is totally object-oriented, and a lot easier to use than (unmanaged) DirectX in C++: you have to write a lot less code.

Longhorn: Longhorn (next major Windows-version) will be built around the .NET Framework, and developing Longhorn-applications will be almost exclusively in .NET (language-independent: use C#, C++, VB.NET, J#, ...), and .NET-applications will probably run as fast as native-code applications.

Security: .NET-applications are (supposed to be ;-) ) more secure than native-code applications: from the control panel, you can configure the security of an application: you can say what it can or can''t do. You can say: application X can''t connect to the Internet, it can''t access the registry, ...

---
tommy online: http://users.pandora.be/tommycarlier
Is it C# that makes making applications easier, or is it .net?
Both:
C# has a much cleaner and easier-to-use syntax than C++.
.NET has the necessary class libraries to make programming easier: builtin XML-parser, file-handling, Internet-access, Windows Forms, Regular Expressions, ...

---
tommy online: http://users.pandora.be/tommycarlier
So does that mean that Visual Basic .NET is equal in power with Visual C# .NET?
Seems to me that all the advantages you have listed for VC# are present in VC++. You may think C# has a cleaner syntax, but that is a matter of preference.
A matter of preference? You can''t deny that C#-code is cleaner, no matter what your preference is. Compare these samples:

Managed C++:
public: static Assembly* Load( unsigned char rawAssembly __gc[], unsigned char rawSymbolStore __gc[]); 

C#:
public static Assembly Load(byte[] rawAssembly, byte[] rawSymbolStore); 


---
tommy online: http://users.pandora.be/tommycarlier
You do not need public: on the C++ function at all. You do not need to put a variable name there, you could make a

#define byte unsigned char __gc[]static Assembly* Load(byte, byte);


which is cleaner?


If you use some tricks, you might get some cleaner C++-code, but you still have the required * and &. These tricks just don''t make it as clean as C#-code.

You don''t need to put a variable name there? True, but that doesn''t make it cleaner. It rather makes it less descriptive. BTW: that is only true if you''re describing the class. If you implement the method, you DO need the variable names. In C#, the description and implementation of methods is one and the same thing.

Just face the fact that C++ is an old language that was not designed to have a clean syntax. It was designed to add object-orientation and other stuff to C, while still being compatible with the C-syntax. C# was designed to have a clean syntax. It was not designed to be compatible with some older language. It was however designed to look somewhat familiar to C/C++(/Java?)-programmers.

---
tommy online: http://users.pandora.be/tommycarlier
You could equally argue that __gc[] and * and & make the C++ code more descriptive, its just a matter of opinion.

This topic is closed to new replies.

Advertisement