Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411644 Posts in 69395 Topics- by 58450 Members - Latest Member: pp_mech

May 14, 2024, 10:04:53 PM

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 23968 times)
Melly
Level 10
*****


This is how being from "da hood" is like, right?


View Profile
« Reply #20 on: November 06, 2008, 08:01:34 AM »

Portability is the reason I'm using C++ right now. I want you poor game-deficient Mac users to bask in the greatness of my immense genius. Grin
Logged

Feel free to disregard the above.
Games: Minus / Action Escape Kitty
Neo1493
Level 0
***


View Profile
« Reply #21 on: November 06, 2008, 09:01:09 AM »

Iam not realy new to codeing I know  basic, gml, lua, and actionscript 3.0 or what ever the langue for flash games is. Now I want to learn a better lanuge like C++ or C#
Logged
Movius
Guest
« Reply #22 on: November 06, 2008, 10:06:00 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.

These are all true. But I was talking mostly about performance issues, rather than portability, etc.

Most indie games aren't going to require the space conserving wonders of 64k demos or the performance of the latest 3D engines. They are more towards the "draw picture on screen, play sound, rinse, repeat" level of performance, for which just about any old language will do fine.

With this in mind he should pick C# as it is simpler. If you're looking for portability and relative simplicity, go for Java.
Logged
Michael Buckley
Level 0
***



View Profile
« Reply #23 on: November 06, 2008, 10:56:34 AM »

With this in mind he should pick C# as it is simpler. If you're looking for portability and relative simplicity, go for Java.

Java portability is pretty much dead. Apple is handling their own Java VM on OS X, and it has a few areas where it is considerably different from Sun's VM in terms of graphics performance. Getting OpenGL bindings to work on some systems is also a huge headache. Java2D isn't fast enough. Java 3D has a great API but is still a little more complex than Java2D. It also doesn't handle system-specific stuff like joysticks.
Logged
Gold Cray
Level 10
*****


Gold Cray


View Profile WWW
« Reply #24 on: November 06, 2008, 03:20:27 PM »

With this in mind he should pick C# as it is simpler. If you're looking for portability and relative simplicity, go for Java.

Java portability is pretty much dead. Apple is handling their own Java VM on OS X, and it has a few areas where it is considerably different from Sun's VM in terms of graphics performance. Getting OpenGL bindings to work on some systems is also a huge headache. Java2D isn't fast enough. Java 3D has a great API but is still a little more complex than Java2D. It also doesn't handle system-specific stuff like joysticks.

And let's not for get about the people who experience physical pain when they try to program in Java. If you're looking for portability and relative simplicity and you are Javasensitive, you're probably going to want to go with something else (like C++).
Logged
Gnarf
Guest
« Reply #25 on: November 06, 2008, 03:27:24 PM »

There are people who do not experience physical pain when they're fucking around with header files and forward declarations? :o
Logged
David Pittman
Level 2
**


MAEK GAEM


View Profile WWW
« Reply #26 on: November 06, 2008, 03:32:08 PM »

There are people who do not experience physical pain when they're fucking around with header files and forward declarations? Shocked

::Raises hand::

I've definitely suffered through the madness that can arise from poorly-ordered headers in the past, but I've picked up some good habits along the way and have learned that it's not really too difficult to work pain-free if you understand the rules.
Logged

Gnarf
Guest
« Reply #27 on: November 06, 2008, 03:36:29 PM »

It's not difficult. And that's just it. It's simple. So simple that a compiler should do it for me.
Logged
Zaphos
Guest
« Reply #28 on: November 06, 2008, 05:42:52 PM »

And let's not for get about the people who experience physical pain when they try to program in Java. If you're looking for portability and relative simplicity and you are Javasensitive, you're probably going to want to go with something else (like C++).
I wouldn't call C++ simpler than Java ... especially because C++ has the kind of complexity where, if you don't understand it, you're going to shoot yourself in the foot badly and not be able to figure out where you went wrong.  And because compiler errors get really ugly really quickly.

Of course you can write code in C++ and not understand things like when you want your destructor to be virtual or why you would want to make single argument constructors explicit ... but you probably shouldn't.
Logged
Gold Cray
Level 10
*****


Gold Cray


View Profile WWW
« Reply #29 on: November 06, 2008, 06:26:17 PM »

Java certainly is better and simpler than C++ for things just as C++ is better and simpler than Java for things. If I were writing a program that has to deal with a lot of strings I would definately choose Java over C++ because Java is full of string manipulation functions that would be a mess to implement in C++. If I were writing a program that uses a lot of fancy pointer magic (lists, trees, etc) I would probably choose C++ because it makes it easier to work with memory than Java does.

The two languages have different programming styles, and since I started out with C++, I find that Java feels bloated and messy. So when it comes to choosing a language for portability and simplicity, the two languages are roughly equal, so you'll want to choose based on your programming style and personal preference. Java is fine if you're not Javasensitive. If you are, though, C++ should be just as good.
Logged
Robotacon
Pixelhead
Level 3
******


Story mode


View Profile
« Reply #30 on: November 07, 2008, 06:42:39 AM »

Portability is the reason I'm using C++ right now. I want you poor game-deficient Mac users to bask in the greatness of my immense genius. Grin

Me too. Portability is the ONLY reason I use C++ now. C++ is horrible if you're used to Java and C# but the added control and portability is worth alot.
Logged
Klaim
Level 10
*****



View Profile WWW
« Reply #31 on: November 07, 2008, 04:25:41 PM »

Correction : C++ don't force any programming style. (Java/C# does)

I like the double edged sword explanation that is quite true.

You just have to understand that C++ is a language that requires you to understand what you do. I mean, understand ALL that you do, at the higher and at the lower level of execution. If you don't then a lot of things will happen that you will not understand. Then you'll have a lot of frustration.
But as someone said first, if you understand what you do in C++, you'll understand what happen in other langages.

In Java and C#, the lower level is hidden and managed by a specific program that is the virtual machine. It have some optimization processes that make most applications fast enough to be useful and as it's hidden from the programmer, he only have to express what he wants to do (most of the time).

Now, knowing that, your choice is not about the langage itself but about what you want to achieve, from a verry high perspective ?

0) You want to make games, quickly : use C# (or Python/Ruby/Java, whatever). The interest is in making games to understand them, so don't overload you work task by loosing some years understanding the sky and the earth in the same time.

1) You want to make a particular game, that would be particularly hardware consuming : first, think again. If you're learning, it's not a verry good idea. Now if you're sure, then all those languages can help. C++ will help you make it fast easily than the others, but it will also be quicker to crash. The other langages will maybe have performance bottlenecks that you'll have to fix with algorithm refctoring or maybe by using C/C++ plugins/lib to replace code that have to be the "quicker" possible (like having the graphical engine in a dll and the rest of the game in another higher langage). So you have choice, but think that anyway a big game = a lot of time = a lot of motivation flow

2) You want to enter the console game industry  : learn C++. You have no choice. We work with that double edged sword because we need to have control and be responsable (and loose money and lifetime).

Now, that said, my personal experience was that when i was at school i made some little non finished games with Basic, then Visual Basic.

One day with a friend we wanted to do a RTS that would be a finished game. Then we choosed c++ because a simple loop test comparison to other langages showed it was faster at the base exectution (thant VBasic - that's easy to get faster anyway).

So we did the RTS, and at the end (9 months later) we knew about 15% of what i know now about C++. I made some ugly mistakes at the time that shock me today. But i did hunt bugs until it was working right.

So you can say that you could learn C++, the basic C++ and have enough to make something that works fine. That depends of the project, that depends on you motivation and other things like that.

Logged

Hajo
Level 5
*****

Dream Mechanic


View Profile
« Reply #32 on: November 10, 2008, 01:49:07 AM »

Correction : C++ don't force any programming style. (Java/C# does)

This reminds me, that, if you have made your choice for C++, but are still relatively new to programming, decide first what methodology you want to use. C++ is big in both procedural and object oriented programming, but in both cases it's good if you know before what you do.

For beginners, procedural programming often seems to be easier to learn, and C++ supports that perfectly well. But it might be difficult to do the step to object oriented programming later, which requires a different way to think, but is quite widely used these days.

C# is more strictly object oriented for sure.

Anyways, you do not only face the task to learn a programming language, but also a methodology. C++ gives you more choices, C# gives you more guidance. So if you choose C++, you should study your chosen methodology a bit more before you actually start diving into the language, since C++ allows you a wild mix of paradigms, and beginners are at the danger of just creating a big mess that is later hard to maintain and develop further.

Briefly said, there is a high danger of getting stuck, if you don't know what you do in C++. This danger is smaller in Java and C#.

Consoles have been mentioned already as a domain of C++. If you don't just look at games themselves, you'll find that low-level libraries, drivers and everything hardware related is often written in C or C++. C# is not that suitable for such kind of software, and Java isn't either. If you are interested in such things, C++ might be the better option.

Logged

Per aspera ad astra
Neo1493
Level 0
***


View Profile
« Reply #33 on: November 10, 2008, 02:29:02 AM »

Thanks for everones thoughts on which one is better I have decieded to start learning c++.
Logged
increpare
Guest
« Reply #34 on: November 10, 2008, 04:33:01 PM »

Correction : C++ don't force any programming style. (Java/C# does)
It doesn't force any one programming style, but still rules many out (it's still pretty-much the most 'multi-paradigm' of 'multi-paradigm' languages though (maybe I'm wrong here though...)).
« Last Edit: November 11, 2008, 01:46:43 AM by increpare » Logged
Neo1493
Level 0
***


View Profile
« Reply #35 on: November 10, 2008, 04:51:10 PM »

Quote
it's still the most 'multi-paradigm' of 'multi-paradigm' languages though).
I thought C# was then again you cant belive everything you hear
Logged
Zaknafein
Level 4
****



View Profile WWW
« Reply #36 on: November 10, 2008, 07:29:12 PM »

C# 3.0 and to-be-4.0 are more and more multi-paradigm because of all the new programming constructs.
For example you can use lambda expressions in C# and declarative programming (like LINQ), and soon there'll be dynamic programming stuff like support for duck-typing to an extent with the "dynamic" keyword and IDynamicObject...
And I for one think it's a very good thing. Deferring work from the programmer to the compiler = always good.
Logged

increpare
Guest
« Reply #37 on: November 11, 2008, 01:47:16 AM »

evidently I'm going to have to learn a little more about c# before saying things like that then...
Logged
dmoonfire
Level 3
***



View Profile WWW
« Reply #38 on: November 11, 2008, 07:34:06 AM »

After looking at my coworkers code, it doesn't really enforce coding style that much. There is a preferred style (camel and pascal case), but we have variable_names, variableNames, _variableNames, m_iVariableNames, and m_VariableNames all scattered in our code and you can tell which one of the developers came from the Java world, which ones came from C/C++, and which ones don't read our style guide. Smiley Same thing with function names.

Yeah, if you use the System.* libraries, you have to conform to their style conventions, but that is the same if you use SDL, OpenGL, or ALUT also. Or if you use Microsoft's C++ libraries (where everything starts with "C" it seems). Its harder to write a classless application in C# than C/C++, obviously, but you can do it.

I will admit, the things that I like the most of C# is its relatively ascetics (I started with C), the garbage collecting, and the threading.
Logged
Melly
Level 10
*****


This is how being from "da hood" is like, right?


View Profile
« Reply #39 on: November 14, 2008, 11:48:57 AM »

I use camelCase for EVERYTHING.

Might be a bad habit, but I think it more pleasing to read.
Logged

Feel free to disregard the above.
Games: Minus / Action Escape Kitty
Pages: 1 [2] 3 4
Print
Jump to:  

Theme orange-lt created by panic