Sign in to follow this  
shrek2

Visual C++.net vs Visual C#.net

Recommended Posts

HansDampf    106
This cannot be answered in one sentence (or even 15.)
Try both and decide for yourself.
If it would be a matter of one being simply better, wouldn't you think you wouldn't have heard of the other?

Share this post


Link to post
Share on other sites
shrek2    122
well i'm currently learning c++ for game programming and i can't believe how much code you need to write in c++ just just to create a simple windows program. i like the forms in .net much better. care to spend more that a few sentences describing your views?

Share this post


Link to post
Share on other sites
Ahnfelt    176
HansDampf: Have you heard of Brainfuck? ;-)

Shrek2:
1) Both of the languages are currently used to develop games by hobbyists and proffesionals alike. None of them have game specific features, so I'd say they're equally good or bad. C++ allegedly has some more options for manual optimization.

2) C# (probably with the XNA framework)

It's generally easier to learn and use a modern language (implies automatic memory management) like C#, Java, or any of the scripting languages like Python, etc.

You will be productive in those languages much faster than you will in C++, and your productivity is likely to stay higher too.

Share this post


Link to post
Share on other sites
shrek2    122
why do industry professionals use c++ when c# seems much easier? almost all the programming job advertisements want c++. is the reason simply because there's a lot of legacy code and people don't want to reinvent the wheel? will most professionals choose c# if they can start all over again?

Share this post


Link to post
Share on other sites
rvdwerf    102
C# isnt crossplatform and/or the code is not as secure as C++
C# its more like java it works on the .net framework.

Preferably i like C++ you have much more control over stuff.
If you want to program easy C# is the way to go

Share this post


Link to post
Share on other sites
RyanZec    124
C++ is still the industry standard because alot of the APIs are still written in C/C++ and C++ is still a little bit faster than C#. Also I don't believe C# was designed to become the industry standard in gaming programming. Each programming language has it purpose and even tho C#, because of the XNA framework, can do game programming, does not mean it should be the standard. This also does not mean you should not use it for you game programming. Use whatever works best for you.

Share this post


Link to post
Share on other sites
Plasmana    261
1) You first question is not easy to answer, however this is my opinion... C++ is currently the path of least resistance to create games that meet todays expectations regarding game performance. It also has overwhelming momentum in the commercial games industry. .NET managed code is the future. A hybrid transition period where native C++ and C# are both used (think platform developers vs. content developers) will probably exist for a while. Eventually C++ will be marginalized to the lowest of levels; just like Assembly Language has been.

2) You second question is easy.. C#/XNA is much easier to learn than C++/DirectX.

Share this post


Link to post
Share on other sites
RyanZec    124
From my understanding C# is cross platform with the MONO framework for Linux.

Also, One point about what I do like about C++ is that you do have more control and have the ability to add ASM code with in your project to gain a little extra speed.

Share this post


Link to post
Share on other sites
Evil Steve    2017
The reason I use C++ rather than C# is that C++ doesn't run on anything but Microsoft operating systems (Except Mono). That means no consoles except the 360, and even then the C# code is much less efficient.

Share this post


Link to post
Share on other sites
Evil Steve    2017
Quote:
Original post by RyanZec
Also, One point about what I do like about C++ is that you do have more control and have the ability to add ASM code with in your project to gain a little extra speed.
The option is there, yes. But I'll be very surprised if you can show me any assembly you've written which turns out to run faster than C/C++ code generated by the compiler (Not MSVC 6, don't even go there) [smile]

Share this post


Link to post
Share on other sites
Should be ...
Quote:
Original post by Evil Steve
The reason I use C++ rather than C# is that C# doesn't run on anything but Microsoft operating systems (Except Mono). That means no consoles except the 360, and even then the C# code is much less efficient.


I would completely recommend C++, simply due to the sheer amount of support, libraries, IDEs, APIs, and sheer amount of information available for it that don't exist in C#.

Share this post


Link to post
Share on other sites
Bah! All this talk about speed, more control, efficiency...

Isn't there more people like me, who choose to code in C++ because they simply *love* C++ ?
Yes, you heard me right! I *love* C++!

Share this post


Link to post
Share on other sites
RyanZec    124
Quote:
Original post by Evil Steve
Quote:
Original post by RyanZec
Also, One point about what I do like about C++ is that you do have more control and have the ability to add ASM code with in your project to gain a little extra speed.
The option is there, yes. But I'll be very surprised if you can show me any assembly you've written which turns out to run faster than C/C++ code generated by the compiler (Not MSVC 6, don't even go there) [smile]



I could not because I can't write ASM code but from what other programmers tell me they can write math libraries in ASM that would be faster than C++, not much faster minf you, but faster.

Share this post


Link to post
Share on other sites
T1Oracle    100
Quote:
Original post by Paulius Maruska
Bah! All this talk about speed, more control, efficiency...

Isn't there more people like me, who choose to code in C++ because they simply *love* C++ ?
Yes, you heard me right! I *love* C++!

I'm like that. I love C++, but I think my addiction to template metaprograming keeps me from picking up a C# book. I need to learn it, but I find the flexibility of C++ much more alluring than the ease of C#. It probably doesn't help that I tend to be masochistic when it comes to working on projects.

I also have invested much more time into it and have just gotten into using Boost. The fact that you can only us MS constructs to program C# turns me off. I don't like MFC at all, Direct X code look overly convoluted to me, and I don't trust MS to make an interface that respects any standards other than their own. I'd prefer to use libraries whose design influences entail the largest group of brilliant minds. Thus far, C# is only derived from MS thinking with zero room for any outside input.

If I need to make ordinary Windows applications or program a web server running windows, then C# is what I would look into. Else wise the motivation for me, is lacking.

Share this post


Link to post
Share on other sites
jpetrie    13104
Quote:

why do industry professionals use c++ when c# seems much easier? almost all the programming job advertisements want c++. is the reason simply because there's a lot of legacy code and people don't want to reinvent the wheel? will most professionals choose c# if they can start all over again?

The reasons are generally (a) legacy code, (b) lack of platform support (CLR implementations for consoles), (c) fear and resistance to change due to the nature of the industry and skepticism about the viability of C# (mainly due to bad benchmarks since C# is relatively young), and (d) lack of expertise (not all knowledge, idioms, and techniques that are valid and efficient in C++ transfer to C#, which partially accounts for the poor benchmarks noted in (c)...) and so on.

Quote:

C# isnt crossplatform and/or the code is not as secure as C++

Wrong and wrong. C# is (arguably) more cross-platform as it compiles to an intermediate language that is JIT-compiled; this results in many cases in an executable that can run on multiple platforms without recompiling the C# code (this is not possible with C++, you must recompile for each target). Furthermore, C# is vastly more secure, supporting code security features in-language and providing automatic handling of potentially dangerous scenarios (memory management) and sandboxing environments.

Quote:

The fact that you can only us MS constructs to program C# turns me off.

You can write complete C# applications without touching a single bit of Microsoft's products (although, yes, Microsoft's tools for C# development are still the most robust and powerful).

Share this post


Link to post
Share on other sites
ejele012    100
With C# and XNA, what Microsoft call Cross Platform is just that you can write a game that can be run over windows and Xbox 360. More info at:

http://msdn2.microsoft.com/en-us/xna/default.aspx

The .NET technology was develop by Microsoft, it runs only on Windows and Xbox 360 and they have a variety of projects with it. You need MONO to be able to use it on other systems. The Mono Project is an open development initiative sponsored by Novell to develop an open source, UNIX version of the Microsoft .NET development platform. So, it can't be 100% compatible. More info at:

http://es.wikipedia.org/wiki/.NET

http://www.mono-project.com/Main_Page

You have more control over C++, you can make unmanaged and managed code with it.

And if you want to use C# with XNA you'll be tied with Microsoft C# Express Edition. Is good, but you don't have more choices.

Share this post


Link to post
Share on other sites
gharen2    520
Shrek2: First rule of deciding a language is good or not: try them both and see what you think. If you ask 10 other people what their favorite languages are, you'll get 10 different answers.

In regards to a few of the comments made so far: people seem to be pretty Xna crazy these days. Not that that's a bad thing mind, it is a very nice api. But lets not forget that managed directx is still supported by microsoft, and you can use opengl from the .net languages. So you're hardly limited in how many platforms you can support with c#, and Xna is hardly the only graphics solution for c# out there. Arguing that you can support consoles other than the xbox 360 with c++ is kind of moot, as 99% of the people here will never be able to develop for them, at least not legally.

Anyways, here's my 2 cents: I'd use c++ if I were a professional programming half life 3 or doom 4, but c# is perfectly adequate for just about anything else. There's absolutely no reason for a hobbiest to not use c#.

[Edited by - gharen2 on May 16, 2007 6:45:11 AM]

Share this post


Link to post
Share on other sites
shrek2    122
where can i find good tutorials on c#.net for game programming? i looked at Game Institute. i think they only use c++.

Share this post


Link to post
Share on other sites
jpetrie    13104
ejele012, you really need to stop proliferating all this incorrect, unverifiable or just plain idiotic information. You're not helping anybody by spreading misinformation, and you're only making yourself look foolish.

Quote:

With C# and XNA, what Microsoft call Cross Platform is just that you can write a game that can be run over windows and Xbox 360.

That does technical fit the definition of "cross platform," you know. As for C# code in general, since it can be made to execute on multiple platforms than it is, itself, cross platform too. Calling C# "cross platform" is not a marketing ploy by Microsoft, it's a fact.

Quote:

The .NET technology was develop by Microsoft, it runs only on Windows and Xbox 360 and they have a variety of projects with it. You need MONO to be able to use it on other systems. The Mono Project is an open development initiative sponsored by Novell to develop an open source, UNIX version of the Microsoft .NET development platform. So, it can't be 100% compatible.

Microsoft's .NET technology is a all-encompassing term that covers a variety of technology, among them an implementation of the ECMA standardized Common Language Runtime. Mono is another implementation of the CLR, it is not strictly a ".NET clone."

Of course it's not 100% compatible, but if you actually possessed any relevant knowledge on any of the subjects you continue to try to pontificate on, you'd realize that C++ cannot claim even close to 100% compatibility across any implementation either.

Quote:

You have more control over C++, you can make unmanaged and managed code with it.

No, C++ is an unmanaged language. You can leverage compiler-specific extensions (in Visual Studio 2003) to augment the language with managed code, or you can use C++/CLI (which is its own language with its own language standard document) to write mixed-mode code. This is hardly "more control," in any case. Please try to look beyond the end of your nose. And how to do you believe you can have control over a language with so many explicit cases of undefined behavior?

Quote:

And if you want to use C# with XNA you'll be tied with Microsoft C# Express Edition. Is good, but you don't have more choices.

You only need C# Express installed to actually proceed with the XNA installation; an unfortunately little snag, I agree. However, once installed, you can reference the XNA framework assemblies from any C# IDE, so you're wrong again. There are number of C# development environments out there, although you're correct in noting that Microsoft's tools are good (probably the best currently available).

Share this post


Link to post
Share on other sites
ejele012    100
Hi jpetrie;

Sorry if I hurt your feelings with my opinion.

Just make this clear for me. With a yes or no is enough.

A game made with XNA can be run over Linux, BeOs or Mac?

You said that "No, C++ is an unmanaged language." So, correct me if I'm wrong.

.NET is not tied to any particular language. Microsoft oficially supports four different .NET languages:

.- Managed C++.
.- C#.
.- Visual Basic.NET.
.- J#.


And lastly, please tell me how can I compile an XNA game in a C# IDE on Linux?

Thanks for your patience.

Share this post


Link to post
Share on other sites
Promit    13246
Quote:
Original post by ejele012
A game made with XNA can be run over Linux, BeOs or Mac?
Maybe. I haven't checked up on the Tao.Xna project lately. Besides, whether or not XNA is cross platform has nothing to do with whether C# is cross platform.
Quote:
.NET is not tied to any particular language. Microsoft oficially supports four different .NET languages:

.- Managed C++.
.- C#.
.- Visual Basic.NET.
.- J#.
This is correct, more or less. Managed C++ and C++/CLI are two separate supported entities.
Quote:
And lastly, please tell me how can I compile an XNA game in a C# IDE on Linux?
How do I compile a DirectX game in a C++ IDE on Linux?

Do you see the problem with your question? XNA is not C#. C# is not XNA. You use XNA if you want to run on the Xbox 360. If you want to run on Linux, you probably ought to use something that runs on Linux, like say OpenGL.

You don't see anybody complaining that C++ is not cross platform because DirectX and Win32 don't work on BeOS.

Share this post


Link to post
Share on other sites
jpetrie    13104
Quote:

Just make this clear for me. With a yes or no is enough.

I will do no such thing, because you've crafted your questions such that a simple yes or no answer undermines entirely the points I was trying to make by avoiding them altogether. Whether you've done this because you're conniving or because you simply fail to understand me, I don't know. However:

Quote:

A game made with XNA can be run over Linux, BeOs or Mac?

No. However, I never claimed as much. I said that XNA being deployable to the PC and to the 360 does technically qualify as cross platform and that C# itself is perfectly cross platform.

Quote:

.NET is not tied to any particular language. Microsoft oficially supports four different .NET languages:

More, actually. But yes, .NET is a buzzword -- a name for a suite of things, some of which include the CLR implementation (I mentioned this already), some of which include the implementations of the CLI and type system, some of which are tools, et cetera.

"Managed C++" is not C++, it was the term used for the set of nonstandard, non-crossplatform, compiler-specific extensions Microsoft shipped with Visual Studio 2003, prior to the standardization of the C++/CLI language. Managed C++ itself is primarily available only in VS 2003; VS 2005 provides C++/CLI.

Quote:

And lastly, please tell me how can I compile an XNA game in a C# IDE on Linux?

I never said you could, this is yet another case of you ignoring or failing to grasp my point. I addressed two related issues, however:
1) C# itself (no mention of XNA) can be compiled on, and executed under, Windows, MacOS and various *nix systems trivially. There also exist tools other than those supplied by Microsoft to write and compile C# code.
2) XNA does not require VS C# Express beyond the install phase. Once installed, you can reference the XNA framework DLL's from any C# toolchain. You'll only lose out on some of the VS integration Microsoft has provided for VS, but any other C# toolchain could offer the same integration if they chose to.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this