Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411528 Posts in 69377 Topics- by 58433 Members - Latest Member: Bohdan_Zoshchenko

April 29, 2024, 12:48:18 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)What are the differences between C++ and C#
Pages: [1] 2 3 4
Print
Author Topic: What are the differences between C++ and C#  (Read 23931 times)
Neo1493
Level 0
***


View Profile
« on: November 03, 2008, 01:17:42 PM »

I am trying to decide which one to learn and use what are the pros and cons of each one
Logged
Ivan
Owl Country
Level 10
*


alright, let's see what we can see


View Profile
« Reply #1 on: November 03, 2008, 01:25:43 PM »

I'm assuming you're talking about C# in the context of .NET?
Logged

http://polycode.org/ - Free, cross-platform, open-source engine.
Michael Buckley
Level 0
***



View Profile
« Reply #2 on: November 03, 2008, 01:29:39 PM »

Well, the list of differences could go on for pages, but I think that you might be able to make the decision based solely on your target platforms. Microsoft's XNA uses C# exclusively. If you're targeting your game to the 360, you'll need to use C#. However, XNA is pretty much only for Windows and the 360. If you want your game on Linux, Mac, Wii, PS3, PS2, DS, or PSP you'll need to go with C++.

EDIT: Obviously C++ works for Windows as well. The only platform C++ won't work on is X Box 360.
« Last Edit: November 03, 2008, 02:33:46 PM by Michael Buckley » Logged
Powergloved Andy
Guest
« Reply #3 on: November 03, 2008, 01:32:06 PM »

Learn C++. C# is great, but learn C++. If you learn to do C++, you can do anything. Simple.
Logged
Neo1493
Level 0
***


View Profile
« Reply #4 on: November 03, 2008, 04:26:12 PM »

Thanks so I guess Ill go start learning C++
Logged
Farbs
Man
Level 10
*


/Farbs


View Profile WWW
« Reply #5 on: November 03, 2008, 04:45:03 PM »

EDIT: Obviously C++ works for Windows as well. The only platform C++ won't work on is X Box 360.
Clarification:
You can code for the 360 in C++, but you need proper dev status and equipment. It's only XNA that's limited to C#.
Logged
Michael Buckley
Level 0
***



View Profile
« Reply #6 on: November 03, 2008, 08:16:06 PM »

Thanks so I guess Ill go start learning C++

I did not know that! Thank you for correcting me. I was under the impression that Microsoft was moving all of their devs over to C#, but I'm glad to find that's not the case. Nothing against C#, but all of my code is in C++.
Logged
Zaknafein
Level 4
****



View Profile WWW
« Reply #7 on: November 03, 2008, 11:38:02 PM »

If you want to learn one of them quickly, I'd look at what prior experience you have with Java or C, or other languages.
C# is much more like Java than like C; it's a managed, garbage-collected language.

Edit :
I'm assuming you're talking about C# in the context of .NET?

There's another C# I'm not aware of? Shocked
« Last Edit: November 03, 2008, 11:42:58 PM by Zaknafein » Logged

bateleur
Level 10
*****



View Profile
« Reply #8 on: November 04, 2008, 03:14:38 AM »

I am trying to decide which one to learn and use what are the pros and cons of each one

C# is a better language, but C++ is way more important and useful in the real world.

If you don't mind programs taking forever to write and crashing a lot, C++ is definitely the right choice. :D
Logged

Hajo
Level 5
*****

Dream Mechanic


View Profile
« Reply #9 on: November 04, 2008, 03:21:26 AM »

If you don't mind programs taking forever to write and crashing a lot, C++ is definitely the right choice. :D

It's not that bad. C++ is just a double edged sword, very powerful, and spanning the whole range from "seeing the bits in hardware registers" to very high level constructs (if you have the proper libraries), and even meta-programming if you let the compiler do calculations on templates.

It's a very broad language, which makes it time consuming to learn, and since it's so powerful on many levels, it gives you plenty of ways to make mistakes.

I use to call C++ a beast. Very powerful, but very dangerous. Tame it, and the power is at your hand. Fail, and it'll eat you.
Logged

Per aspera ad astra
Cymon
Level 9
****


Computer Kid


View Profile WWW
« Reply #10 on: November 04, 2008, 09:06:16 AM »

C# is fantastic for rapid development. Unfortunately it ends up being the very definition of "quick fix" because Microsoft is going to change C# and .net on you every 6 months meaning something is going to break. So your rapid developed product becomes something you have to support and revisit every 6 months or risk it becomming obsolete. The consequence is you end up spending so much time on your old projects that you can't ever go on to your new ones, which is most likely exactly what Microsoft wants.

A vote for C++ is a vote for freedom!
Logged

Cymon's Games, free source code, tutorials, and a new game every week!
Follow me on twitter
dmoonfire
Level 3
***



View Profile WWW
« Reply #11 on: November 04, 2008, 09:11:11 AM »

I wouldn't go as far to say it will break every six months. It seems to take forever to get your user base to move major revisions and since you can install most of the different versions side-by-side, it really doesn't break. Most of my original stuff from years ago still runs rather smoothly on C# today.

There are advantages of C#. Memory collecting, classes are a bit easier to understand (mainly by the virtue of single inheritance), and Visual Studio is pretty nice for coding in it. There are advantages of C++, mainly more established and larger library selection.

But, it comes down to preferences. I prefer C# over C++, but I use both on a relatively daily basis (two products at work).

I also like that Mono runs pretty well on Linux for C#, so I get the cross-platform stuff I happen to enjoy.
Logged
Skofo
Level 10
*****



View Profile
« Reply #12 on: November 04, 2008, 07:35:46 PM »

Hidden third option: learn python. It is yummy.

But between those two, learn C++. Why would you want to restrict yourself to only Microsoft's [crappy] proprietary platforms?
Logged

If you wish to make a video game from scratch, you must first invent the universe.
isaac
Level 2
**



View Profile WWW
« Reply #13 on: November 04, 2008, 07:44:26 PM »

Hidden third option: learn python. It is yummy.

But between those two, learn C++. Why would you want to restrict yourself to only Microsoft's [crappy] proprietary platforms?

Yesss. I decided to try python out yesterday, and it's super fun! Though I find the lack of curly brackets slightly disconcerting.
Logged

Alex May
...is probably drunk right now.
Level 10
*


hen hao wan


View Profile WWW
« Reply #14 on: November 05, 2008, 06:29:07 AM »

I am trying to decide which one to learn and use what are the pros and cons of each one

C++ gives you lower level access to the computer and generally gives you the power to do more efficient and powerful code. That said, the cost of this is having to use a fairly outdated and unwieldy language that is fairly laborious to use.

It will take you years to get good at programming in general, regardless of which you choose, and in that time you will probably reach a higher level of coding standard if you learn a lower level language like C++. But it is a long and frustrating and complicated road.

You may get better short term results from learning C#, and speaking personally now that I have started using C# for my own work I find it very tiresome and boring to go back to using C++, regardless of the implications for the future of my code as guesst points out (personally I believe a short period of code rehab every 6 or so months is a small tradeoff for the bonus I net in coding performance by using an interpreted language, and I should point out I've been using C# for well over a year now (actually more like over 2 years I think) and haven't had to do any such maintenance).

It is important to know what you are getting yourself into and what you intend to use the language for before committing to it; as also pointed out C++ and C# are not your only options and C# is certainly not your only option for interpreted language game dev.

I would say that the Visual Studio IDE for C# really is a massive bonus, it just makes coding anything a lot faster as you have a lot of shortcuts and things made faster, plus there is edit and continue and all sorts of other stuff that is just faster to work with using C# and .NET than with C++. Not having to worry so much about memory is also a boon and not having to trudge through the process of making millions of header files and shit like that is really great too. It feels like a breath of fresh air after using C++ for 6 years but it may just be confusing and awful for a person new to both.

Hope that helps.
Logged

Madnis
Level 0
**


Vincent, were you programmed to bug me?


View Profile
« Reply #15 on: November 05, 2008, 09:55:14 PM »

I'm going to go out on a limb and say that most programmers over their career will learn several languages. The underlying principles are the same, and I would even say that the more languages you learn, the easier it is to learn new languages.

I also believe that even though they share common ground, each language can offer a slightly different perspective on how to approach and solve problems.

Learning one language does not lock you into that language. If you are just starting, pick something that will get you up and running quickly. It's important to get the positive feedback from having made programs that do stuff, or you might see your programming efforts pretty derailed.

I have no experience with C#, but I would recommend Python. I actually love C++, but I don't wish it on anybody as their first language (unless you have an excellent teacher/tutor, or you are just plain brilliant).
Logged

increpare
Guest
« Reply #16 on: November 05, 2008, 10:15:53 PM »

[...] I would even say that the more languages you learn, the easier it is to learn new languages.
I'd say the more *types* of languages you learn, the easier it is to learn new ones.  Learning C, then fortran, then pascal, isn't going to help you much with lisp, say, any more than if you just had one of them learned.

Quote
I also believe that even though they share common ground, each language can offer a slightly different perspective on how to approach and solve problems.
Different languages can offer vastly different approaches to different problems.  An SQL developer is going to have a different approach to various tasks to a javascript developer, for instance.

Quote
Learning one language does not lock you into that language.
Agreed.  Even moreso when one considers all these various standard libraries supported by many languges, like SDL, Allegro, OpenGL, and the like, that make hopping about really really easy.
Logged
Madnis
Level 0
**


Vincent, were you programmed to bug me?


View Profile
« Reply #17 on: November 05, 2008, 10:40:11 PM »

Different languages can offer vastly different approaches to different problems.

But of course, good sir! My choice of words was far too humble, for fear of seeming immodest in my presumptions.
 Gentleman
Logged

Movius
Guest
« Reply #18 on: November 06, 2008, 02:05:36 AM »

* post assumes you are new to coding

You'll need to learn good programming practice rather than a specific language. To learn good programming practice you'll want something simple. In this case C#. Once you have learnt good programming practice you will find it easy to switch to other languages if the need arrives.

There are many benefits to c++ over c# & vice versa. You will never make use of any of them. 90% of indie game makers will never make use of any of them. So go with whatever you find easiest to work with.
Logged
bateleur
Level 10
*****



View Profile
« Reply #19 on: November 06, 2008, 05:13:44 AM »

There are many benefits to c++ over c# & vice versa. You will never make use of any of them.

Ooh, now that's a rather controversial claim, sir!

If nothing else, C# is garbage collected, which make a HUGE difference to novice and expert alike for any program more complex than "Hello, World".

And as for C++, the main motivation is portability. This might seem like something a novice would never use, but as soon as you decide to buy a Mac as your next machine, you'll suddenly care a lot.
Logged

Pages: [1] 2 3 4
Print
Jump to:  

Theme orange-lt created by panic