C++ or C#?

Started by
33 comments, last by CTar 17 years ago
I agree with JBS. C++ can't really be out of date as some people said though. Its syntax might be butchered to heck and back, but all the modern features are still there, which means it is no way outdated. C# has been really easy to pick up for me, but not in the 3D aspect. Therefore, I recommend C++ for 3D programming because of the extensive amount of libraries it has, and overall more support.

[Edited by - Frodo on April 26, 2007 2:40:56 PM]
Advertisement
Personally I'd say go with C# and check out Microsoft's XNA. It does a lot of the tedious work for you which allows you to get right down to actually coding a game and not a whole bunch of managers / data loaders. It runs plenty fast, comparable to many of my openGL/C++ games I've written. Another plus is you can use your same code more or less and compile games for xbox360.

Here's the link for XNA: http://creators.xna.com/
Thanks for all the replys.

At the moment I'm thinking C++ with DirectX, and Blender for the 3D modelling.

I need to ask a few questions though:

1. What elements/concepts of C++ are harder to learn than C#?
2. What resources should I use to learn C++?
3. How long approx. would it take me to learn C++ if I study about an hour a day?

I'll ask more questions when I need more help. Cheers!
Quote:Original post by Cyb3rGlitch
Thanks for all the replys.

At the moment I'm thinking C++ with DirectX, and Blender for the 3D modelling.

I need to ask a few questions though:

1. What elements/concepts of C++ are harder to learn than C#?
2. What resources should I use to learn C++?
3. How long approx. would it take me to learn C++ if I study about an hour a day?

I'll ask more questions when I need more help. Cheers!


What elements/concepts of C++ are harder to learn than C#?
Possibly not harder, but just more. By its very nature, C++ has more stuff to learn than C#, so it can be considered "harder" for beginning programmers. Not because of the language (although when you move into obscure parts of the language, the syntax can become a little convoluted, and the errors generated are always verbose) - no, not because of the language, but because you are exposed to the machine far more than in C#. C# abstracts a lot of things away from you, like pointers, the heap and the stack (including stack unwinding with exceptions), allocation and deletion, etc. These things are present, so there's more to learn in C++ to do the same amount of work as in C#, which is why people can develop products in C# faster than C++.


What resources should I use to learn C++
This one's easy - use Microsoft's Visual C++ 2005 Express Edition. It's a free download from Microsoft itself.


How long approx. would it take me to learn C++ if I study about an hour a day?
I've been learning C++ for about 7 years now, and I like to think I know the language pretty thoroughly - but I'm still learning design patterns with regards to C++. You don't need as much time to be able to produce tight game code, but it helps if your project becomes massive.
[ search: google ][ programming: msdn | boost | opengl ][ languages: nihongo ]
Thanks. When I asked about resources I meant tutorials, books etc. (I already have Visual C++ Express Edition).
yeah, programming is about getting fluent with the language rather than learning it, learning it is easy, straight forward and all. Just keep at it.
another thing that makes C# easier is that , while there has been more code provided for C++ , pretty much everything you need to use everyday is provided with C# in the .net framework in a single huge library that's easy to use & of course has all of it's aspects made to work well together so you don't need to use multiple libraries from diferent sources with different designs that will require some hacking around to work together
Quote:Original post by _goat
What elements/concepts of C++ are harder to learn than C#?
Possibly not harder, but just more. By its very nature, C++ has more stuff to learn than C#, so it can be considered "harder" for beginning programmers. Not because of the language (although when you move into obscure parts of the language, the syntax can become a little convoluted, and the errors generated are always verbose) - no, not because of the language, but because you are exposed to the machine far more than in C#. C# abstracts a lot of things away from you, like pointers, the heap and the stack (including stack unwinding with exceptions), allocation and deletion, etc. These things are present, so there's more to learn in C++ to do the same amount of work as in C#, which is why people can develop products in C# faster than C++.
I think you missed a major part of the language if you think that it's harder just because it has "more" stuff to learn. The C++ language targets an abstract machine, as such many of the underlying behaviors of the language are undefined. This undefined behavior is usually what nails people the most, and is typically why they fail my tests. This is a function of the language. The C# language targets a very explicit machine (that which is represented by the CLR), as such its behavior is mostly well defined.
Quote:How long approx. would it take me to learn C++ if I study about an hour a day?
I've been learning C++ for about 7 years now, and I like to think I know the language pretty thoroughly - but I'm still learning design patterns with regards to C++. You don't need as much time to be able to produce tight game code, but it helps if your project becomes massive.

I've been learning C++ for about 15 years now, and I can still find things in the language specification that surprise me.

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.

Neither ;)

http://www.digitalmars.com/d/
Quote:Original post by Washu
Quote:Original post by _goat
What elements/concepts of C++ are harder to learn than C#?
Possibly not harder, but just more. By its very nature, C++ has more stuff to learn than C#, so it can be considered "harder" for beginning programmers. Not because of the language (although when you move into obscure parts of the language, the syntax can become a little convoluted, and the errors generated are always verbose) - no, not because of the language, but because you are exposed to the machine far more than in C#. C# abstracts a lot of things away from you, like pointers, the heap and the stack (including stack unwinding with exceptions), allocation and deletion, etc. These things are present, so there's more to learn in C++ to do the same amount of work as in C#, which is why people can develop products in C# faster than C++.
I think you missed a major part of the language if you think that it's harder just because it has "more" stuff to learn. The C++ language targets an abstract machine, as such many of the underlying behaviors of the language are undefined.


The undefined behavior isn't really hard, it's just more stuff to remember. You need to keep a lot of stuff in mind if you want to produce code with a well-defined behavior. For example when using && or || do the operators act as a sequence point? How about operators like + and -? Is it undefined behavior to increment a pointer until the memory it points to is undefined if you don't actually dereference it? Many C++ programmers can't answer these question without looking at least one of them up (they weren't directed at you Washu, I know you can answer them). When you have to remember all kinds of stupid stuff like this, then you can't save your mind for the real programming.

Quote:Neither ;)

http://www.digitalmars.com/d/

D is generally not accepted as a better language than both C++ and C#. You can argue that it's better in some regards and for some tasks it might be appropriate, but at least try to argue, don't just post a link. The only thing it contributes to the discussion is confusion for the OP, so unless you can add something constructive I suggest you don't add anything. (This wasn't meant as an attack, just a friendly reminder, because what you have now is useless).

To the OP: I don't really know much about beginner C++ resources, but I do know that I have never come across a decent complete web resource for a beginning C++ programmer (I once saw the starts of a good beginning standard C++ ebook, but I don't believe it was ever finished). I have heard that C++ Primer is a very good start, but I haven't read it myself. If you choose to read something else then you can generally determine whether it's very bad by checking the following:
- Does it "#include <iostream.h>"? If it do then put it away right away; it's teaching a pre-standard form of C++ which shouldn't even work on a modern compiler.
- Does it use "char*" variables for strings? If it does it follows very bad practices.
- Does it have "void main()"? That is also non-standard.
That absence of those doesn't necessarily mean that it's a good resource though. It's just a way to spot resources either written by complete beginners, which are very old or written by a person who doesn't know modern C++.

This topic is closed to new replies.

Advertisement