Jump to content
  • Advertisement
Sign in to follow this  
snrobbo

C++ or C# - can anyone advise

This topic is 3894 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am about to start a new project at home. its going to involve graphics, user input (mouse & key board), modular based in design, the possbility of running on different platforms and be as fast as possible. I would normally use C++, but C# has interested me. Does C# have the performance (both in pure power and in graphically side)? Is C# going to change, like managed C++. Can OpenMP be used in C#? Does run effectivity on other platforms (Linux, Apple, etc) and can its run on PDAs? Does any-one have any advice. sites that could help. many thanks for any help

Share this post


Link to post
Share on other sites
Advertisement
Quote:

Does C# have the performance

Languages don't have speed.

Quote:

Is C# going to change

All languages evolve.

Quote:

Does run effectivity on other platforms (Linux, Apple, etc) and can its run on PDAs?

This seems in contrast to your performance issue, especially with regard to PDAs. However, yes, C# is multiplatform (look into mono).

Share this post


Link to post
Share on other sites
Quote:
Original post by snrobbo
Does C# have the performance (both in pure power and in graphically side)?

Yes.
Quote:
Is C# going to change, like managed C++.

Probably; it has before. But the changes in the past have been adding rather than changing features, and I find it extremely unlikely that that will change in the forseeable future.
Quote:
Can OpenMP be used in C#?

Yes, though I have not done it.
Quote:
Does run effectivity on other platforms (Linux, Apple, etc) and can its run on PDAs?

Yes; see Mono for non-MS platforms.

Share this post


Link to post
Share on other sites
I know that speed is relative to the designer abilities, but i was just trying to get a feel for C# performance over C++. I did not want to limit this solution to just desktops, but possibly PDAs.

Could you code say Half-Life or Unreal in C# and get a similar peformance to c++. what sort of dependencies does C# have over C++.

Share this post


Link to post
Share on other sites
Quote:

Could you code say Half-Life or Unreal in C# and get a similar peformance to c++.

Sure.

Quote:

what sort of dependencies does C# have over C++.

None. Both require runtime environments to "work properly," C#'s runtime environment (mono or .NET) is a little more obvious than C++'s (the CRT). C#'s runtime environment is larger, in that it includes a collection of tools (such as the JIT compiler) in addition to the standard library, et cetera.

Compact versions of the C# runtime environment (the "CLI") are usually available for limited systems.

Share this post


Link to post
Share on other sites
Quote:
Original post by snrobbo
I know that speed is relative to the designer abilities, but i was just trying to get a feel for C# performance over C++. I did not want to limit this solution to just desktops, but possibly PDAs.


Obtaining high-performance PDA graphics, whether in C++ or C#, will require hand-written ARM assembly. The high-level language used, whether C++ or C#, is only tangentially relevant to the performance of the program.

Quote:
Could you code say Half-Life or Unreal in C# and get a similar peformance to c++. what sort of dependencies does C# have over C++.


Half-Life or Unreal are not "C++ only" games. If you were to use C# where C++ was used in those game, then it's very probable that you would get a game with the same performance, or possibly even faster if you had more time to optimize the bottlenecks.

Share this post


Link to post
Share on other sites
Thanks for the advice.

i thought C# was interpreted byte code, not in native code. how can it be as fast C++.

I hear C# has an automatic Garbage Collector, is this usefull or a performance hit. I have never needed it before. does it have any create any issues to be thought of when designing, as in C++.

One area i was interested in was simulation of a battlefield environment and its entities, working across multiple machines. i know C++ and delphi can do this, I was just wondering were C# could be a suitable contender.

The only thing i do not like about the Dot net, is its new managed C++, taking it away from the original C++.

Can OpenMP be used in C# (I've used it before in C++). There is talk of multi-core features being added to C++ compilers, would i be correct in thinking this may appear in C# compilers.

Share this post


Link to post
Share on other sites
Quote:

i thought C# was interpreted byte code, not in native code. how can it be as fast C++.

It is JIT compiled, so what executes is native. You didn't read the link I gave you.

Quote:

I hear C# has an automatic Garbage Collector, is this usefull or a performance hit.

Both.

Quote:

does it have any create any issues to be thought of when designing, as in C++.

Of course. You cannot write code like you would in C++ in C#. It won't work very well -- it will be inefficient and/or dangerous. Similarly, you can rarely write code in one language like you can in another. They are different languages, they have different characteristics to be aware of.

Quote:

One area i was interested in was simulation of a battlefield environment and its entities, working across multiple machines. i know C++ and delphi can do this, I was just wondering were C# could be a suitable contender.

Yes.

Quote:

The only thing i do not like about the Dot net, is its new managed C++, taking it away from the original C++.

This implies you have a poor understand of all of the terms in that sentence. .NET is a CLI implementation (among other things) and does not have much to do with "Managed C++" (except being an environment that Managed C++ can run in). Managed C++ was a collection of MS-specific compiler extensions to the VS2003 compiler. They "take away" from C++ no more than any other compiler extension takes away from any other language (which is to say, it doesn't; don't use it if you don't want it). C++/CLI, which is a standardized language, is itself an entirely distinct language and does not "take away" from C++ any more than Pascal "takes away" from C++.

Visual Studio .NET (VS 2003) and later versions do not, dispite common misinformation, force you to use Managed C++, C++/CLI, or anything of the sort.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!