• Announcements

Archived

This topic is now archived and is closed to further replies.

Visual C++ .NET vs Visual C#

Recommended Posts

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.

Share on other sites
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

Share on other sites
Is it C# that makes making applications easier, or is it .net?

Share on other sites
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

Share on other sites
So does that mean that Visual Basic .NET is equal in power with Visual C# .NET?

Share on other sites
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.

Share on other sites
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

Share on other sites
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?

Share on other sites
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

Share on other sites
You could equally argue that __gc[] and * and & make the C++ code more descriptive, its just a matter of opinion.

Share on other sites
More descriptive? It was not meant to add descriptivity (is this a word?), it was a necessity. __gc[] means that the variable is garbage-collected: in C#, every variable is garbage-collected. * and & is necessary to pass variables by reference: the programmer doesn''t need to know this. You only need to describe what the user needs to know.

I think we should stop this little argue. Is it really that important? Could we not just end this by saying that C# has a cleaner syntax by design, and C++ was not designed to have a clean syntax, and has gradually grown and matured which made the syntax less clean?

I agree that C++ is more powerful, but if you compare Managed C++ using only the .NET-implementation with C#, C# has the advantage of being designed specifically for .NET.

---
tommy online: http://users.pandora.be/tommycarlier

Share on other sites
Visual Basic .NET is a good as C#, and the syntax is so similar now that a converter could easily be made, but I am studying for GCSE and don''t really have time. Do you know of any, by the way?

Share on other sites
The next version of VS will support C++/CLI, a new way of programming C++ with .NET. So todays Managed C++ syntax will R.I.P. Just google....

This "new C++" will feel muche more native than Managed C++. At MS PDC slides, you''ll get more information.

Share on other sites
quote:
Original post by DrGUI
Visual Basic .NET is a good as C#, and the syntax is so similar now that a converter could easily be made, but I am studying for GCSE and don''t really have time. Do you know of any, by the way?

The thing is: you don''t need a converter. Make your code in whatever language you want. .NET-languages work perfectly together. You can write one library in VB.NET, another one in C#, and then write an application in Managed C++, that uses both libraries.

---
tommy online: http://users.pandora.be/tommycarlier

Share on other sites
quote:
Original post by DrGUI
Visual Basic .NET is a good as C#, and the syntax is so similar now that a converter could easily be made, but I am studying for GCSE and don''t really have time. Do you know of any, by the way?
I believe SharpDevelop has an integrated converter, at least from C# to Visual Basic .NET. I''m sure there are more - simply using System.Reflection.Emit() and some reverse parsing...

Share on other sites
There''s also an application called Reflector, which can generate C#-code, VB-code, ...-code from compiled assemblies. Of course, the variable-names, the comments and other stuff can''t be re-generated.

---
tommy online: http://users.pandora.be/tommycarlier

Share on other sites
I''d normally say "don''t bother" with C++ unless speed is a concern (like in graphics work).

If you know C++, learning C# can be accomplished in a few days at most.

C# makes things a lot simpler, and the performance lag is a non-issue for most applications.

Obviously, games are another beast alltogether though.

I''d recommend knowing C++ regardless. If you ever need to do non-windows work, you''ll be using it anyway.

Share on other sites
From my experience, C++ surpasses C# in all aspects of software development with an exception, maybe, of productivity (using available tools). One reason C# is more productive is because it comes with a huge library of tools such as database. In other words, everything (most) is done for you already in C#.

C++ is so much faster than C# especially in a multithreaded application.

Kuphryn

Share on other sites
quote:
Original post by kuphryn
From my experience, C++ surpasses C# in all aspects of software development with an exception, maybe, of productivity (using available tools). One reason C# is more productive is because it comes with a huge library of tools such as database. In other words, everything (most) is done for you already in C#.

The increase in productivity alone makes it worth it to switch to C# for new projects(and meshing new components into existing software).

And I seriously question your assertion about the C++ tools with in comparision to C#.

quote:
C++ is so much faster than C# especially in a multithreaded application.

WTF!

The .NET framework has extensive multithreading support, and C# has biult in multithreading support too.

Multithreading preformance comes down to the end programmer, the language cant help brain dead design choices.

Share on other sites
"C++: an octopus made by nailing extra legs onto a dog."

Share on other sites
Sorry, but compiling to bytecode vs. compiling to ASM is always going to favor C++ in terms of performance.

There should be no question as to which performs faster. Only an idiot would say that C++ isn''t faster performing than C#.

The real question is whether or not it''s a significant enough difference to justify staying with C#.

Share on other sites
quote:
Original post by Etnu
Sorry,

Apology not accepted.
quote:

but compiling to bytecode vs. compiling to ASM is always going to favor C++ in terms of performance.

Why? Disregarding initial JITting costs, which are amortized to ~0 for any non-trivial application anyway, there is no theoretical reason why a JITted application couldn''t outperform a statically compiled one.

Share on other sites
Putting aside the JIT issues, what about pointers?

I have little experience in C++ but is there something that can be done with C++ pointers than is practically impossible with C#''s refrence types, delegates ... etc?

Share on other sites
quote:
Original post by Hantu
Putting aside the JIT issues, what about pointers?

I have little experience in C++ but is there something that can be done with C++ pointers than is practically impossible with C#'s refrence types, delegates ... etc?

Hundreds of things... 99% of them bad. I've only started learning C# and it looks like a really nice language. The only thing that bugs me is the lack of const methods. The ability to be a total const-nazi is one of C++'s strengths IMHO.

quote:
Original post by Arild Fines
Apology not accepted.

Arild, I agree with you wrt JIT and I think you generally post good replies, but you need to lay off the caffeine.

[edited by - ChaosEngine on May 19, 2004 4:16:48 AM]

Share on other sites
quote:
Original post by Hantu
Putting aside the JIT issues, what about pointers?

I have little experience in C++ but is there something that can be done with C++ pointers than is practically impossible with C#''s refrence types, delegates ... etc?

If you manage to do so, the code itself will probably also be impossible to understand, even for the programmer.

• Partner Spotlight

• Forum Statistics

• Total Topics
627665
• Total Posts
2978529

• 10
• 10
• 12
• 22
• 13