C++ or C#?

Started by
50 comments, last by Promit 17 years, 5 months ago
Quote:Original post by NIm
One note: I've never fooled with C#, but I understand that it's harder to write cross platform code with it. I'm not sure though. Will someone either back me up or shut me up?
Incorrect, compiling with Mono will give you an executable file that you can use on all Mono-compatible platforms (Linux, Windows, Mac, etc). Mono has implemented most of both .NET 1.1 and 2.0.
Rob Loach [Website] [Projects] [Contact]
Advertisement
Question about Mono from a Mono newbie.

An app compiled with mono can be run as-is on other platforms? As in, I compile a Mono app in windows, I can run that executable in OSX, Linux, other mono supported platforms? I don't have to recompile or anything? The target platform just needs mono installed? Just trying to clarify if thats what you mean. Thanks

J
Quote:Original post by Promit
Quote:Original post by Kixdemp
I prefer C# by a million times, C++ is too complicated, but how would the performance be affected if I do it in C#?
Performance would probably be (significantly?) better in C#.


While I understand why you answered the way you did, I think the way you said it merely will cause massive arguments. If he prefers C# a million times over, of course his C# code will wind up being better than his C++ code. But the way you said it sounded as if you were implying that C# is a (significantly?) faster language in general, which is where all the fighting will come in.

I'd consider being a little less vague about your commentary. It'll make these kinds of topics a better place to be in and not one to avoid.

I love both languages really, but I never really liked Managed DirectX that much. (mainly because it's so similar yet so different from Unmanaged DirectX, leading to confusing moments)
When I said "Are you trying to start a battle" I was talking about how saying things like that without explaining yourself often start battles.

Oh, and look what happened.
"C# is faster than C++". That seem pretty bold to me

It would seem with all the "expert engineers/programmers" someone would confirm that C# is faster than C++ by publicly posting their testing environments for scrutiny. When the hypothesis that C# is faster than C++ is proven, it would no longer be considered irresponsible to make such a claim.

It seems like there are plenty "C# is God's native tongue" people with an agenda so I don't see any lack of motivation to prove their point. However, I have seen no effort to do so.
Quote:Original post by BlueHabu
"C# is faster than C++". That seem pretty bold to me
It's also a claim that doesn't appear anywhere in this thread.
Quote:However, I have seen no effort to do so.
I can't speak for others, but I feel no obligation to prove myself to others. I've put a lot of time into researching performance. If others aren't willing to spend even a little effort on the matter, that's their problem. I just don't want their ignorance polluting these discussions.

Anyway, the answer had nothing to do with the languages and everything to do with the poster's experience. C++, C#, and most other environments are performance minefields even when you know what you're doing.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Quote:Original post by DrEvil
Question about Mono from a Mono newbie.

An app compiled with mono can be run as-is on other platforms? As in, I compile a Mono app in windows, I can run that executable in OSX, Linux, other mono supported platforms? I don't have to recompile or anything? The target platform just needs mono installed? Just trying to clarify if thats what you mean. Thanks

J

Another question, from a (lower than) newbie. If I make a project in Mono and I have .NET installed on my computer. Can .NET running my Mono-made program? Does Mono depend on .NET or does it have it's own interpreter/VM?

Beginner in Game Development?  Read here. And read here.

 

Quote:Original post by BlueHabuIt would seem with all the "expert engineers/programmers" someone would confirm that C# is faster than C++ by publicly posting their testing environments for scrutiny. When the hypothesis that C# is faster than C++ is proven, it would no longer be considered irresponsible to make such a claim.

well i think 99% of the studies show that c++ or c are faster than c#
whilst that maybe the case, as has been pointed out, for the original poster, since he prefers c# then theyre prolly gonna get more perfoamnce out of it than c++

Quote:Original post by BlueHabu
"C# is faster than C++". That seem pretty bold to me

It would seem with all the "expert engineers/programmers" someone would confirm that C# is faster than C++ by publicly posting their testing environments for scrutiny. When the hypothesis that C# is faster than C++ is proven, it would no longer be considered irresponsible to make such a claim.

It seems like there are plenty "C# is God's native tongue" people with an agenda so I don't see any lack of motivation to prove their point. However, I have seen no effort to do so.


If such a survey is done, it should be 'complete', because only then it would carry some meaning. It should include a performance/cost ratio, where cost is the money or hours spend to develop each program. When we say 'faster', do we mean the maximum or the "average"? If I need 3 months to write a C++ program that is 10% faster than the program I would write in C# in one month, and if given one month the C++ program would actually perform worse than the C# one, then which is faster? We're not talking about,say, Python(which I love) or compiled vs interpreted code here, where the answer seems obvious. C# programs are also JIT-compiled into native code.

Note, I don't particularly(or at all) like C#, but this seems a logical question to me.

Quote:Original post by BlueHabu
"C# is faster than C++". That seem pretty bold to me


____ is faster than ____ is basically by definition bold to the point of being wrong. Given one program in one language, I can guarantee I can make you a slower one in any other language. As such, I can "prove" any language is "slower" than any other - and conversly, that any chosen language is "faster" than any other by showing slower examples in any other language.

The current state of compiler technology is that you can eventually produce, if you're an expert, faster programs in C++ than just about any other language, probably.

The fact that in many circumstances you'll have to spend more time optimizing parts of that code than will ever be spent actually executing it on all of the computers it is installed on, for that product's entire shelf life, to achieve this "pinicle of optimization", is a footnote usually skimmed or coughed over in barely audiable tones by those trying to prove some sort of point about C++ being "omg teh superiorz".

And for me? I'm pretty sure I'd produce a more optimized C++ program than a C# one in a given alotment of time for the majority of situations. Not because C++ is somehow superior, but because I've been using it since before it was even standardized - about 10 years - whereas my knowledge of C# is at best fairly laughable.

And this exact same kind of sentiment is what just about everyone who's voiced an opinion here. We're not claiming C# is faster than C++. We're just claiming it's faster for the OP.

Quote:It would seem with all the "expert engineers/programmers" someone would confirm that C# is faster than C++ by publicly posting their testing environments for scrutiny.


If only it were that simple. Problem is, it's impossible to create the perfect comparison, and even those done by experts are all too often badly flawed - and contradictory even when they arn't. It's the age old question of which is a better tool: the saw or the hammer? The answer depends entirely on wheither you're trying to cut a plank or nail them together. Only in the realm of programming, entire toolsets are heavily intertwined, and even the simple problems tend to be a lot more complex.

This topic is closed to new replies.

Advertisement