C++ or C#

Started by
222 comments, last by GrouchyIssues4 20 years, 5 months ago
I''m new here and would like to start off by saying hi to everyone. I''m a senior in high school and plan on majoring in Computer Science at NJIT when I graduate. Hopefully, after that, I''ll eventually go on to a career in game development. I''ve always had an interest in computers, video games, and programming, but have only now started to seriously learn how to program. I''ve tried to learn the fundamentals of programming, primarily through Beginning Programming for Dummies and internet tutorials. I know some BASIC, but hardly enough to get by. Right now I''m trying to learn Java and some Internet coding (i.e. HTML, XML, &#106avascript, Flash, etc.). If all goes to plan I''ll have a class in it in January, which I desperately need. To get to the point of this post, after learning Java I''d like to get aquainted w/ C/C++. I''m just curious, how does C++ compare to C# (I''ve tried to figure it out from the much researching I''ve been doing on programming.)? From what I''ve read, it seems C# is Microsoft''s answer to Java. More importanly, would it make sense to create games in C# or should we just all stick to C++ primarly? Phew! Sorry about the long post. Just wanted to get that all out.
Advertisement
Hi GrouchyIssues4.

Once you learn a language well, it is much easier to migrate to a new language. My suggestion to you is to use the language you feel most comfortable with, try a little bit of each if you don''t know. Once you learn that language well, you can learn another one fairly easy.

It is hard to recommend any specific language without knowing your background but I''d say C++ is a good language to loarn. I started with VB and later switched to C++ without too much hassle.

I can''t say anything about C# since I have only seen a few lines of code. It seems ok and I assume it will be a good language to know when MS Longhorn is the OS of choice (probably 2006/2007 or so).

If your goal is to program games, I would definately recommend C++ based on the little experience I have.

Good luck!
Learn C/C++ first. Then do C# if you are still interested, that way you''ll at least appreciate the stuff C# does for you.

I prefer C# for hobbyist development but keep my C/C++ skills sharp because thats where the industry is (and probably will be for a long time).
Everything C# can do, C++ can do better.
IMHO-It would make since to make games in C#. There are some things with C# and the .NET framework that would speed up game development and would make the code cleaner. It may not be as fast as C++ but I think most games will be coded with that or similar. When I said some things that I thought could be useful. Possibly a web program for patches, ladder rankings, etc... used from within a program. And just the general C# code that would make code cleaner and quicker to write. Garbage collection, etc.. And the possibility of using any of the .NET language to script the objects in your game.

quote:Everything C# can do, C++ can do better.


I''m not trying to start or get involved in a flame war but, have you ever even used C#? If you are saying faster, and at a lower level then yes. C++ can do it "better". I love C++ and I believe it has it''s uses and places but I think eventuall C# and the CLR OR a similar technology will be used for most application programs. I believe C/C++ will eventually be used for only operating system components and I think that''s a good thing.
quote:Original post by Programmer One
Everything C# can do, C++ can do better.



That's true if you don't count reflection, ASP.NET, benchmarks on longhorn with C# 2.0 =] Also you just have to be kidding me if you think you can come CLOSE to the productivity in C# with C++.

Maybe you guys really don't understand what generics does for the language in 2.0 do you? =]

Not a flame.. but I guess it's just the old motto of the new thing isn't as good as the old one, such as the ASM -> higher level languages move.

Flame me if you'd like, but please note I professionally programmed with C++ for around 6 or 7 years now. At work EVERYTHING had to be changed over to C#.. just like in most business production environments.

Also please note that what Microsoft says, happens. You may not like it, you may like it. But when Microsoft pushes everything they have towards managed code and C#.. that is where the world will move.

Also.. how can anybody disagree that managed code is one of the greatest options for a Windows operating system? It will show a security and stability not seen yet on the platform.

I've heard many people complain about "I hate windows XP, it crashes a couple times a day". Those are the people who need a clue on how to use a computer, considering at work there are approximately 40-50 workstations with different hardware and software configurations.. why don't we see this problem? I mean these people need to realize most of the time you see a crash it is due to an application poking around in memory where it shouldn't be (usually by accident) or a buffer error right?


In response to the initial thread though, I think both C++ and C# are great languages. Also I would probably recommend learning C++ first in order to understand the underlying reasons C# was developed, as it fixes many of the core problems that C++ has today. Also don't be fooled by people that tell you C++ can do everything C# can =]

a) I mean if you look at the longhorn ALPHA benchmarks using VS.NET 2004, managed code is way ahead of unmanaged code. As well as Microsoft stating that "native" code execution will be retained as backwards compatibility (It's pretty much the same as DOS applications being allowed to run on Windows 95), but managed .NET is where the platform is going.

b) At our business we are now 30-50% more productive depending on the task because things can be coded a lot quicker. As well as the fact we can spend more time on business logic and less time on debugging buffer and pointer problems.

c) It is the paradigm standard for the future of Microsoft Windows from 2006 onwards.


I see the game development community waiting until around 2006-2007 in order to adopt the new managed paradigm and coding with C# and managed C++. Until then I would learn C++ and object-oriented fundamentals, and then move on to C# once you are knowledgable in C++.


EDIT: I really should have stated more on productivity.. which is one of the MAJOR aspects of managed code with .NET

When you are sitting around coding your own games and applications in your spare time for fun.. sure go ahead and use what you want and take as long as you want to do it.

In the business world, whether it be business applications, server-side applications, or game development.. what a lot of people don't understand is that PRODUCTIVITY > PERFORMANCE. As long as it performs "well enough" by the time Christmas comes.. release it.

C# and the framework are cutting MONTHS to YEARS off projects even as I post =]

[edited by - Imperil on November 11, 2003 10:36:41 PM]

[edited by - Imperil on November 11, 2003 10:39:01 PM]
I''d recommend learning C++ first. This is because most code samples, documentation, and FAQs for game programming are done in or for C++, so it''s easier to take advantage of exisitng knowledge. This goes double if you''re about to start college. Most universities will be teaching in C or C++ (with the occasional Lisp dialect).
I hope you guys are intelligent enough not to start a flamewar...

I agree with SiCrane and Ratman, learn C++ first so that you know what''s really happening in a program. I learnt BASIC then VB before I put my step on C++. Though I had been using VB for 2-3 years, frankly I had no clue that string is actually a collection class until I learnt C and C++. I wouldn''t know about vector, and I wouldn''t know about list.
Since C# uses .net its execution speed is very slow compared to native C++ but compared to managed C++ it is pretty much identical.

C++.net can do just about everything that C# can (except covariant returns ::mutter:: ) and its not tied to just .net so I think, for gaming it has to be the way to go.

If speed isnt critical then using managed (.net) C++ can give you a good productivity gain and the 2003 compiler and IDE is very easy to use.

Regards


BaelWrath

If it is not nailed down it's mine and if I can prise it loose,
it's not nailed down!

[edited by - baelwrath on November 12, 2003 8:42:13 AM]
BaelWrathIf it is not nailed down it's mine and if I can prise it loose,it's not nailed down!
quote:Original post by BaelWrath
Since C# uses .net its execution speed is very slow compared to native C++ but compared to managed C++ it is pretty much identical.

C++.net can do just about everything that C# can (except covariant returns ::mutter:: ) and its not tied to just .net so I think, for gaming it has to be the way to go.

If speed isnt critical then using managed (.net) C++ can give you a good productivity gain and the 2003 compiler and IDE is very easy to use.

Regards


BaelWrath

If it is not nailed down it's mine and if I can prise it loose,
it's not nailed down!

[edited by - baelwrath on November 12, 2003 8:42:13 AM]



This statement is only correct if you call 95-98% of native execution speed "Very Slow". If you meant anything else than you are sadly mistaken =]

One of the reasons for this is not .NET and the JIT compiler. Please note that when the application is run for the first time it is compiled by the JIT which takes almost no time at all.. and then runs almost identical to native code, although it has all the benefits of a managed environment.

The ONE reason some people deem C# is slow is due to the fact it is still a beta in a way. Although used for many commercial and business appplications, it isn't completely done until version 2.0.

So far with what we've seen in C# 2.0 (due to generics mainly which gets rid of much of the boxing/unboxing issue) it performs about 97-99% of the speed of native C++. Also when you look at the results on Longhorn (the next version of Windows to be released in 2 years) managed code actually runs at about 130% or so of the speed of native code.

Remember native code is able to run in order for "backwards compatability" just like DOS was in Windows 95. Managed code is the future for Windows programming (managed C++, managed C#, managed VB) and will be the most optomized, secure, stable, and overall most native code will phase out. Microsoft chose to push C# the hardest in this area of future development because of the true object-oriented nature of the language, and not being a "language with object-oriented features".


"C++.net can do just about everything that C# can "

- lol I love seeing lines like this. Until you have reflection in C++, ASP.NET, the major productivity boost, and Microsoft pushing it the hardest, no it can't do everything C# can.. which is the reason our whole development team here had to switch over to the language.


[edited by - Imperil on November 12, 2003 9:19:36 AM]

This topic is closed to new replies.

Advertisement