• Advertisement
Sign in to follow this  

C# or C

This topic is 3877 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Some background: I am a 14 year old Texan. I come from a background of web designing, and therefore know HTML, PHP, javascript, little ASP, little bit of other languages. I have been coding PHP since I was ten, and learned HTML at 8. -------------------------------------------------------------------------------- I started learning C++ recently, mainly just because I wanted to see if I could :p, but I didn't get very far at all because it was extremely dull, I knew the basics, just not the syntax for them, so I switched to visual basic. I have created an extremely advanced calculator in it, but I have decided that it isn't the best language to learn because it really creates sloppy coders, and has no where near the power I want. I still have all my C++ stuff, including the Digital Mars compiler. I have also downloaded Visual C++, Visual C#, and of course Visual Basic (all express, I am fourteen and therefore have no $$$). So, I searched around and have decided the most popular starting language is C++, however when I go to you for beginner reource fo people who are already coders, then it gives me a crapload of stuff about Direct X. Questions: 1.) Are C# and C the same thing? 2.) How do I make games with directX (is it free)? 3.) If DirectX is not free, C or C++ (or c#?)?

Share this post


Link to post
Share on other sites
Advertisement
1) Nope. C is the basic procedural language, C++ is the object oriented language based off of that (and the current standard for game development) and C# is something about "managed code" or somesuch that I'm really not qualified to comment on.
2) You'd access DirectX through another language. It's mainly a set of libraries to build a game on top of, and you can work with it with most modern programming languages. It's completely free to download the SDK. You'll want to find tutorials for this (it's something I've never gotten into myself... one of these days I'll get my head out of my AI and get to it!)
3) There are free compilers for those languages. Someone else will probably be able to point you in the right direction...

Share this post


Link to post
Share on other sites
  1. No - C and C# are completely different languages. Their syntax can be similar, but fundamentally they are different. C++ grew out of C (initially it was a superset of C, but they have since moved in slightly different directions). C++ added Object Oriented Programming capabilities on top of C. Many years later, with the advent of Java, Microsoft designed an interpreted language based off C++. That is C#. An "interpreted language" is something you probably don't need to know about now.The Digital Mars compiler is quite outdated now, and Microsoft's compiler (7.1 and greater, being VS2003 and later - 2005 is 8.0) is more compliant.

  2. Yes, the DirectX SDK (Software Development Kit) is free for any and all developers. You'll find the download at Microsoft's site somewhere. You make games with it by including the correct header files from your project (C++), or importing the correct namespaces (C#, VB), and using the provided classes and functions. MSDN (Microsoft Developer Network) has many, many tutorials on how to do so, for every major language they support (aka, not Java). Their tutorials all use their respective IDE (Integrated Developer Environment) - the Visual Studios (they are also very good IDEs themselvse). There's a link to MSDN in my signature.

  3. NA


Hope that helps! C++ is a complex and sometimes arcane language, but you'll have a greater understanding of programming by the time you finish it compared to C# and Java. However, those languages are more refined, and probably easier to get started with. Many people on these forums have different ideas.

Share this post


Link to post
Share on other sites
You may also want to look into learning C# and using XNA.

It uses DirectX (correct me if I'm wrong) and has some decent tutorials, including video tutorials.

Edit: For some reason, I couldn't add the link: http://msdn2.microsoft.com/en-us/xna/default.aspx

Share this post


Link to post
Share on other sites
Quote:
Original post by _goat
Many years later, with the advent of Java, Microsoft designed an interpreted language based off C++. That is C#. An "interpreted language" is something you probably don't need to know about now.
C# is not, by any stretch of the imagination, "interpreted". Nor does it share much of anything in common with C++.
Quote:
C++ is a complex and sometimes arcane language, but you'll have a greater understanding of programming by the time you finish it compared to C# and Java.
I think that's a completely bogus claim. C# and C++ will give you different slices of "programming", and both are woefully incomplete.

Share this post


Link to post
Share on other sites
Im 14 as well and started to learn C++ but had trouble because making console apps is only fun for 5 minutes, so I tried out C# and it is much easier to learn and as far as I know you can do anything with C# that you can do with C++. Although C# is a little slower.

Share this post


Link to post
Share on other sites
Quote:
Original post by Promit
Quote:
Original post by _goat
Many years later, with the advent of Java, Microsoft designed an interpreted language based off C++. That is C#. An "interpreted language" is something you probably don't need to know about now.
C# is not, by any stretch of the imagination, "interpreted". Nor does it share much of anything in common with C++.


I didn't say they were similar, I said C# was based off C++ (and others, of course). Anders Hejlsberg (lead technician at MS) has said so himself.

Quote:
Quote:
C++ is a complex and sometimes arcane language, but you'll have a greater understanding of programming by the time you finish it compared to C# and Java.
I think that's a completely bogus claim. C# and C++ will give you different slices of "programming", and both are woefully incomplete.


I should have made myself clearer, and I considered it, but I left out a lot of detail for the sake of the OP, and not experts reading my post. C and C++ will teach you everything you need to know about the "fundamentals" of programming. I'm not talking about paradigms here, or areas of programming - I'm not talking about dynamic typing or advanced (some would argue "complete" is a better word) RTTI - I'm talking about how a computer, physically, does things. Memory addresses, offsets, alignment, registers, etc. C# hides some of these things. RTTI and dynamic typing are systems/methodologies put in place "over" these base processes. And they're useful, but if you only know them, and not how they're implemented, you can be left high and dry when it comes to basic computer processes.

That's what I meant.

Share this post


Link to post
Share on other sites
Quote:
Original post by _goat
Quote:
Quote:
C++ is a complex and sometimes arcane language, but you'll have a greater understanding of programming by the time you finish it compared to C# and Java.
I think that's a completely bogus claim. C# and C++ will give you different slices of "programming", and both are woefully incomplete.


I should have made myself clearer, and I considered it, but I left out a lot of detail for the sake of the OP, and not experts reading my post. C and C++ will teach you everything you need to know about the "fundamentals" of programming. I'm not talking about paradigms here, or areas of programming - I'm not talking about dynamic typing or advanced (some would argue "complete" is a better word) RTTI - I'm talking about how a computer, physically, does things. Memory addresses, offsets, alignment, registers, etc. C# hides some of these things. RTTI and dynamic typing are systems/methodologies put in place "over" these base processes. And they're useful, but if you only know them, and not how they're implemented, you can be left high and dry when it comes to basic computer processes.

That's what I meant.


I compleatly agree.

C++ will give you a understanding of how things work (like _goat said) buth it will also make you learn a lot of c++ specific idoms and techniques that are hard to ditch when crossing to C#, so i would sugest learning pure C first as it is simple procedural lanuge that will give you a basic understanding of pointers and memory managment, and then cross to C# to learn OO. All this aplys only if your goal is to lear C# in the end. If you want to learn c++, avoid procedural programing and std C library, as you will confuse this with c++ (witch is OO). I've seen a lot of people who say they can program C++ buth don't even understand basic concepts such as virtual members or inheritance, insted they use procedural programing with c++ syntax.

Share this post


Link to post
Share on other sites
Quote:
Original post by _goat
Memory addresses, offsets, alignment, registers, etc.


I would argue that C or C++ themselves do not teach anything about memory addresses or registers either, since they are designed to be independent of the function or even existence of these concepts. In fact, the memory model used by both C and C++ expressly avoids discussing the nature of memory addresses, mostly restricting itself to "pointers are (buffer,offset) pairs", with some ramblings about implementation-defined conversion to and from integers. And although these languages do teach you something about alignment, but I've never found knowledge about alignment useful in any situation where knowledge of a low-level language (assembly, C, C++) was not also required. I would hardly consider these three concepts "fundamentals of programming", as much as they are "fundamentals of machine-level programming", judging by their impressive absence from most non-machine-level languages who do their jobs just fine without it—and most of the programming done today is not machine-level anyway.

As for offsets... what's the conceptual difference between offsets and array indexing?

Either way, except for assembly, most languages are just too high-level to accurately describe how the machine works, and this does include C and C++ (simply because they're portable while machine-level knowledge isn't), and a language possibly isn't the best way of learning how the machine works anyway.

[Edited by - ToohrVyk on July 16, 2007 3:50:56 AM]

Share this post


Link to post
Share on other sites
All this is true in the theory, but tell me, do you know a c++ programmer who is not farmiliar with addresses or registers ? IMO learning c/c++ implies the learning of basic machine-level programming, and every c/c++ book should at least cover bare minimum of this.

Share this post


Link to post
Share on other sites
Quote:
Original post by _goat
C and C++ will teach you everything you need to know about the "fundamentals" of programming. I'm not talking about paradigms here, or areas of programming - I'm not talking about dynamic typing or advanced (some would argue "complete" is a better word) RTTI - I'm talking about how a computer, physically, does things. Memory addresses, offsets, alignment, registers, etc. C# hides some of these things.
How a computer physically does things is no more fundamental than type systems -- there's a strong case to be made that the type system is rather more fundamental than largely irrelevant implementation details like memory addresses and registers. That C# hides those things should be a strong tip off that the physical details are not fundamental at all.

What is fundamental (as far as imperative programming goes anyway) are variables, control flow and control structures, functions, and basic logic. C# and C++ both have plenty of that.
Quote:
All this is true in the theory, but tell me, do you know a c++ programmer who is not farmiliar with addresses or registers ? IMO learning c/c++ implies the learning of basic machine-level programming, and every c/c++ book should at least cover bare minimum of this.
I suppose that depends on perspective. From where I'm sitting, I see a lot of C++ programmers who do not understand registers or memory at all. They might think they do -- they got the textbook explanations of pointers and registers, after all -- but they only have those simplified views and very little idea of the reality of how things work.

C++ -- well, really C programmers -- will deal with pointers a lot. But how many of them understand addressing modes? Segments? Virtual memory? Pages? Page faulting? Translation lookaside buffers? All they know is the comfortable illusion of a flat memory space which has been created for them. A lot of beginners don't even realize that they can't access other programs' memory simply by setting pointers to certain values.

Learning C++ doesn't magically gain you machine level knowledge. If anything, it can create serious misconceptions about how things work.

Share this post


Link to post
Share on other sites
Quote:
Original post by RedDrake
All this is true in the theory, but tell me, do you know a c++ programmer who is not farmiliar with addresses or registers ? IMO learning c/c++ implies the learning of basic machine-level programming, and every c/c++ book should at least cover bare minimum of this.


I certainly am not familiar with addresses or registers. Actually, I would say that my knowledge of mainstream CPU registers and of mainstream computer memory layout is insignificant and sometimes nonexistent.

EDIT: to quote Promit, I have no idea what addressing modes, segments, virtual memory, pages, page faulting and translation lookaside buffers are, or how they work.

I do not consider myself to be a bad C++ programmer, though, quite the contrary, and I am extremely familiar with the guarantees that C++ makes over the underlying hardware—the irony of this is that this allows me to write safer and more portable code than the average C++ programmer, because I don't mix up platform-specific details and language-enforced concepts. I have never found the need to know about the specifics of my hardware unless using that hardware was my primary objective—which is why I am also highly familiar with the ARM processors found in 2000-2004 PocketPCs and their corresponding assembly, and also with the hardware and PTX assembly of the GeForce 8800.

But at that point, I'd say a programmer needs to learn about machine-level programming when he actually needs to do machine-level programming, not when learning a self-advertised general-purpose language.

Share this post


Link to post
Share on other sites
Quote:
Original post by Promit
stuff


Quoted For Spartian Emphasis

In today's multi-core, multi-processor, multi-server beowulf clustering environment, individual machines and address spaces, processors, cores and caches are quickly headed towards the "minor implementation detail" bin, as we rack up the virtualization atop those resources to build an environment we can focus on the important stuff of our actual programs on -- it seems impossible to rationalize the C or C++ way being more "fundamental" than C# to programming.

Simpler in it's implementation, sure, but that's not exactly a selling point. In fact, it's quite the opposite, simply because you're forced to pick up where they left off, and they left off very very early compared to your alternatives.

Sure, not every program needs a cluster to run (yet), but it gets at my point: Whatever is fundamental to your programming depends on your platform, not machine architecture. C++ and C# are both a certain type of platform -- C# a far superior one in many many ways.

[Edited by - MaulingMonkey on July 16, 2007 4:51:35 AM]

Share this post


Link to post
Share on other sites
Quote:
Original post by awesty
Im 14 as well and started to learn C++ but had trouble because making console apps is only fun for 5 minutes, so I tried out C# and it is much easier to learn and as far as I know you can do anything with C# that you can do with C++. Although C# is a little slower.


C# is a lot easier to get a hold of though if you don't stick to programming in any one language for you'll find what you're doing is very repetitive in nature just to any one language you're using.

So if isn't consoles that is boring it will be GDI windows thats boring. You have to keep moving and learning new things.

If you want to get into game programming quickly and easily (without all the hassle about multicore this or shader that) XNA game studio express is your best bet. Comes with lots of nice tutorials to get you started too, uses C# as the language.

Share this post


Link to post
Share on other sites
Yeah, I am not sure how this topic evenm got started, I don't remember creating it... But i was craptired last night so... meh. I have already decided to go with C#, mainly cuz it looks like fun :P. I created the exact same post and got a completely different conversation :P, oh well.. here is my snswer to all the bickering: I really cannot believe that I asked in essence what programming language to use... very stupid move of me. Also, C++ and C# are both good languages (or so I have been told) but I also here that C# is in demand right now and that it is also slightly easier to learn.

Share this post


Link to post
Share on other sites
Quote:
Original post by mohaakilla51
...mainly cuz it looks like fun :P..


Sometimes in the academic bickerings that take place on these forums, we sometimes forget the fundamental reason why many of us program...and why we sometimes choose a language: quite simply, that language is more enjoyable to work in.

Mohaakilla51, to me, it seems like you've hit the nail on the head.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement