Sign in to follow this  
Followers 0
JSThePatriot

C++ vs C#

13 posts in this topic

I have always heard about C++ and have been on the path to learn it in the near future. Then someone comes along and tells me that C# is supposedly better. I ask why? They dont know. So I am coming to someone that apparently knows a bit about C++ and asking what would be the point of using either one.

I have tried googling this and no one seems to have quite the answer that I am looking for. (Maybe I should google more, but I thought I would ask here before I continue my search).

Thanks,

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites



C# is syntatically similar to C++. However, it is a .NET language meaning it requires the .NET framework on Windows or Mono on Linux/Unix. The are many differences and similarities between the two.

Whomever said it was "better" probably isn't worth listening to. Like all languages, I'm sure it has its strong points and weak points. But to say its better than another language shows a lack of experience or a refusal to accept other ideas. What language is best changes depending on the situation.

Share this post


Link to post
Share on other sites

C# is syntatically similar to C++.  However, it is a .NET language meaning it requires the .NET framework on Windows or Mono on Linux/Unix.  The are many differences and similarities between the two.

Whomever said it was "better" probably isn't worth listening to.  Like all languages, I'm sure it has its strong points and weak points.  But to say its better than another language shows a lack of experience or a refusal to accept other ideas.  What language is best changes depending on the situation.

<{POST_SNAPBACK}>

Okay with that in mind which would you think is better for a gaming environment?

Thanks for the above reply,

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

Gaming environment?

Do you want to create a game?

Share this post


Link to post
Share on other sites

Definitely C++.

Only power-users or developers have the .NET framework. Even then, some of the new versions have things the old don't, so the user having the correct version is not so great.

Then there is the overhead for .NET apps. Since "compiled" programs are only in an intermediate state, they have to be converted at run-tim to machine code and that also means massive memory usage for simple things (Relatively speaking) because it has to load the environment for the application to run in.

It's a great idea in theory, but like I said in another thread, I don't expect .NET's potential to be fully realized until at least 2 - 3 years after Longhorn comes out (I have jokingly said about a decade...).

Share this post


Link to post
Share on other sites

Thank you for the insight... Do you think it would be worth my while to learn both?

I am not sure if I understood you correctly. What you are saying is that C++ right now is better but in 2-10 years that C# will become a standard and very powerful?

Thanks very much for taking the time to explain this to me.

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

If you want to write applications that will reach the general, usually PC illiterate, audience, C++ is probably the way to go. If, however, you aren't too concerned with mss audience appeal, then C# might be a good option. However, you can always learn just C++ and then, later, if need/desire to write .NET stuff comes around, use the managed extensions to C++ to write .NET applications.

I am in no way an industry expert and I really haven't been programming for very long. However, knowing what I do about PC users in general combined with the massive requirement of having the .NET Framework installed in order to run a .NET application, I'm making an uneducated gut prediction that .NET really won't be able to fly in a non-coporate environment until at least a couple years after Longhorn comes out. This is, of course, assuming Longhorn has .NET integrated. After the release of Longhorn, it will take quite awhile for a good portion of home users to get "upgraded" to Longhorn.

So my prediction boils down to, I don't think you'll see .NET really take off for the general user until the general user is given .NET without them having to know what it is or why its there. Of course, in a coporate environment, things could be different because if .NET is required, then it'll be installed by whatever the company does to rollout new PC's.

A lot of what I have heard about C# is that its very similar to C++. What that means is, if you have a good working knowledge of C++, it's probably a fairly easy task to learn C# (Compared to learning a language from scratch).

The choice is really up to you. These are my opinions. Whether they are right or not, we'll see in a decade or so or if .NET takes off and becomes the next big thing; whichever comes first. I also suggest taking a look at CodeProject for information on the languages. You might also post on some of their forums asking for their opinions as you're likely to find a lot more people with a lot more insightful (Albeit insidious) opinions there.

Edit: Learning both wouldn't be a bad idea, although I wouldn't do it at the same time.

Edited by Valik

Share this post


Link to post
Share on other sites

For learning go C++ , after you get used to that a few years or more then C# might be something to look into. For gaming, definately C++ hands down, a little asm never hurts either for optimization but some would disagree. I'd wait for longhorn before diving into C# personally.

Share this post


Link to post
Share on other sites

C++ is a very powerful tool. I would recommend, if you have more than one computer, installing Linux, on one of them. Put your scripting applications on that. C++ is a lot more powerful on a more "open" OS such as Linux, while as for windows... You hit a lot of unnecessary "walls". Especially for gaming.

Share this post


Link to post
Share on other sites

C++ is a very powerful tool. I would recommend, if you have more than one computer, installing Linux, on one of them. Put your scripting applications on that. C++ is a lot more powerful on a more "open" OS such as Linux, while as for windows... You hit a lot of unnecessary "walls". Especially for gaming.

<{POST_SNAPBACK}>

Funny that, the only walls I've ever hit are my own lack of knowledge in certain fields I'd like to be more profficient in.

Incidentally, as I mentioned before, unless you are doing cross-platform or Linux exclusive development, writing software on Linux is about as pointless as stapling your crotch. Only the most rudimentary and basic console applications will actually run on Windows. Anything GUI-related won't; unless you use GTK or something on Linux and then download the library for Windows.

Where in the world did you get the notion that Linux is better for C++ than Windows? The better platform depends on what platform you want to write software for as that is the one you will be spending time on.

Share this post


Link to post
Share on other sites

I have already installed linux on my box. (I have had to remove it, but I will put it back eventually). I think someone was wanting the game to be cross platform, but I think we will just make it Windows only, just for ease of use.

Thanks for all of the info on C++ and C#. That was my gut feeling on it.

Now does anyone know of a good starting place to learn? A book, cd, website, something?

Thanks,

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

If you are wanting a program to be truely cross-platform, then there are a few ways I see doing it:

1) Write it in Java. The same program does not need to be recompiled to run on different platforms, but it is about 3 times as slow as a natively compiled program.

2) Write it in C++, using different compatable interface routines. By changing the interface you are using, the program is now usable on another system. This is the way that the big game manufactuers do things. It helps to have an cousin who works for EA. :ph34r:

3) Write two programs, using the same ideas, but taking advantage of the features of each platform in your code. This is the most time consuming, but your resulting program will be better for it. This does mean that you have to change your source code for each platform for each change in the program design.


David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

Share this post


Link to post
Share on other sites

If you are wanting a program to be truely cross-platform, then there are a few ways I see doing it:

1)  Write it in Java.  The same program does not need to be recompiled to run on different platforms, but it is about 3 times as slow as a natively compiled program.

2)  Write it in C++, using different compatable interface routines.  By changing the interface you are using, the program is now usable on another system.  This is the way that the big game manufactuers do things.  It helps to have an cousin who works for EA. :ph34r:

3)  Write two programs, using the same ideas, but taking advantage of the features of each platform in your code.  This is the most time consuming, but your resulting program will be better for it.  This does mean that you have to change your source code for each platform for each change in the program design.

<{POST_SNAPBACK}>

Excellent. I know we wont be going with the first option.

That is cool you have a cousin that works for EA games.

We I am sure will either do 2 or 3, I was thinking more along the lines of 3, but as you stated that would take longer to develop/update.

I think we may just go with single platform to start with.

:( Thanks for all of this input! :lol:

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0