C# vs C++

Started by
20 comments, last by Washu 13 years, 2 months ago
Ugh can we just delete these threads?

XNA is targeted at developers who don't have a huge C++ codebase to build on. C# is a better all-around language than C++. With programmable GPUs, less and less of the "must go fast" code is run on the CPU anyway, and the parts that do can be called from C#.

If that's not a good enough reason, they also don't want you to be able to run native code on XBox or phones.
Anthony Umfer
Advertisement
The original post is a bit confusing, because: XNA != DirectX. XNA is a abstraction layer over DirectX functionality. I know on PC/Windows it actually uses the DX runtime underneath, but XNA can be used on XBOX 360 and Windows Phone, too, so it's actually a multiplatform framework. Being an abstraction it sure hides some aspects but it also eases the overall use, hence forgiving again. AFAIR XNA officially is intended to be used only from C#, though. And, of course, there are means to get "bare" DirectX from C#/managed languages, e.g. with SlimDX.

"Stronger" is vague. Both languages (and others) have their advantages and disadvantages. And you can do very low-level stuff with a managed language like C#.

By the way: Was XNA really written in C# ? Not C++/CLI or something ?
As you gravitate towards higher level languages, everything becomes faster and also easier. By faster, I mean that you can get a game up and running much faster than a lower level language. By easier, I mean that the language is streamlined more towards people who do not want to concern themselves with the nitty gritty of programming. There are trade-off of course, functionality decreases and the programs execution time will generally decrease as well. How much this occurs depends on alot of factors, but I am speaking in generalities here, not absolutes. I realize there are examples where higher level code can create faster code than low level stuff, but in general, it does not.

So, this is why c# was created, to make it easier tor people to get into programming.
Wisdom is knowing when to shut up, so try it.
--Game Development http://nolimitsdesigns.com: Reliable UDP library, Threading library, Math Library, UI Library. Take a look, its all free.

So, this is why c# was created, to make it easier tor people to get into programming.


This is... entirely incorrect. The rest of your post is less absolutely incorrect, but pretty misleading.

I doubt we could find an authoritative 'why was C# greenlit?' answer, but it likely involves a lot of Microsoft internal specific business reasons to not use Java (due to Sun's ownership) and not use C or C++ (due to the difficulty in creating good, secure software in them). Making a language not low level is a design decision rarely made to help beginners but instead to make existing programmers more productive at stuff that doesn't require low level bit-fiddling (which is almost everything these days).
I am sorry you feel that way. Hope you feel better thought. Hey, at least my post was, "less absolutely incorrect, but pretty misleading." That doesn't even make any sense.
Wisdom is knowing when to shut up, so try it.
--Game Development http://nolimitsdesigns.com: Reliable UDP library, Threading library, Math Library, UI Library. Take a look, its all free.

I am sorry you feel that way. Hope you feel better thought. Hey, at least my post was, "less absolutely incorrect, but pretty misleading." That doesn't even make any sense.

What he's saying is when you're not entirely wrong, what you're saying is misleading.

Honestly, I find it kind of silly you'd suggest C# was created to make it easier to get into programming. Higher level languages aren't made to make it easier to get into programming (arguably with the exception of the BASIC line of languages), they're made because systems these days don't need the intimate low level access and strict control over memory they used to need in order to get any resemblance of performance, and more time can be spent implementing your idea instead of boilerplate. The fact that C# is not miles behind C++ in performance and even under certain circumstances can outperform C++ is a testament to that.

Honestly though I think this thread should be closed. It's going to erupt into a war. They always do.
This can get real ugly here.

A lot of entry level programming was taught in Java, in my university, exactly because it didn't have those low-level features. You could argue that higher-level languages are made for that. Though more experienced programmers like using them too, so it pretty much seems like a personal preference!

Why C#? Because the following statement is false:

linux, on 04 February 2011 - 07:42 PM, said:
C++ is much stronger than C# due to the fact that it is a lower level language.
[/quote]

What does stronger mean? Someone mentioned "getting games up faster" .. ok,THAT is a definite statement. "stronger" is just an arbitrary measure, because C# DOES lack feature present in C++, and even if you don't like those feature and think they're just annoying, other people might find them quite useful.

I shouldn't argue about this, and I'm not going to post more, but it's a lot about personal preferences!

Also, XNA and C# go so well together partially because Microsoft are fans of their proprietary stuff, which, is another issue that people have with C#...but that's a whole other topic.

Though more experienced programmers like using them too, so it pretty much seems like a personal preference!


No. There's significant differences between the two. Pretty much any metric you care to choose. The problem comes that for different programmers, for different problems, for different goals... there's quite a bit of variance. The best tool for the job varies, but it's certainly not based on what you like most.

[quote name='Milcho' timestamp='1296862775' post='4769797']
Though more experienced programmers like using them too, so it pretty much seems like a personal preference!


No. There's significant differences between the two. Pretty much any metric you care to choose. The problem comes that for different programmers, for different problems, for different goals... there's quite a bit of variance. The best tool for the job varies, but it's certainly not based on what you like most.
[/quote]
Edit: Yeah, I'm not going to respond to this.
I vote we close this thread.

Hello everyone,
How come XNA was made in C# not C++? Many people know that C++ is much stronger than C# due to the fact that it is a lower level language. Also DirectX was originally made for C++ so using it in C# would mean that parts are begin cut off. So why C#?



aside from any ridiculous and pointless arguments over which language is better .




XNA was done in c# for a two reasons.
- portability (bytecode level)
- security (walled off access to hardware, especially the 360)


it has very little to do with language choice (other than ms evangelising c#).

your never as good as they say you were, never as bad as they say you was.

This topic is closed to new replies.

Advertisement