C, C+, C++ and C#
AIman
Posts: 531
I have heard that C is becoming older and that C# is becoming more relant.
I also heard that each step forward in C is backwards compatable.
First question - Which is the better language to learn looking at it from a view point of whats to come.
Second question - is it backwards compatable?
I also heard that each step forward in C is backwards compatable.
First question - Which is the better language to learn looking at it from a view point of whats to come.
Second question - is it backwards compatable?
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
C# (C Sharp) is basically a "C like syntax" wrapped over Visual Basic Functions. There is pretty much a one to one mapping between VB Functions and C# functions. (It may be exactly 1:1, but I'm leaving a fudge factor in place.)
Outside of a Microsoft environment, C# is virtually non-existant.
I think you may have the right idea, but possibly wrong syntax in saying "C is backwards compatable". GENERALLY, C code from an older version of a C Compiler will move forward (or a C complier will work "backward" with code). New C code is less likely to work with an older complier, assuming you take advantage of new features in the new compiler.
It might (depending on the specific environment) be more appropriate to say that it isn't the "C Language" that's getting upgraded, but the interface, and any libraries the vendor has written.
When dealing with microprocessor environments (like the STAMP, SX, or Propeller) the compiler is kind of working as a "translator" and "converting" your C Code into either assembly code, or some type of token set for further processing.
In any of the cases with "plain old C", if you code doesn't use macros specific to the development environment, or special libaries that are subject to evolution and change, it should be fairly portable, both forward and backward, and even from different environments (PC to Unix to Microprocessors). Of course this totally falls apart if you take a C program designed to put a bunch of graphics on a PC screen, and try and use the same code to drive graphics on a totally different system (for example from a PC to a MAC or Linux box). This isn't really the "C" Code, but the libraries used.
C++ is object orientated C, and is really a system unto itself. Most C++ code tends to be machine or environment specific, not becuase of the nature of C++, but due to the "standard (read Vendor Specific) libraries" included with the various C++ Compilers.
If it were only that simple (as stated above) life would be good, but at least I hope I've given you some answers that make sense.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John R.
8 + 8 = 10
Well put!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller + Hardware - extra bits for the bit bucket =· 1 Coffeeless KaosKidd
·
Unless you have a special reason for using C#, I would stick to a standard language like C or C++. If you're going to be programming for microcontroller-based embedded systems, I'd stick to C. If you're mostly working with desktop and laptop systems or resource-rich embedded systems, go for C++.
My own particular bias is towards Pascal and its derivatives including Delphi. It's a language where you can express low-level concepts easily yet it enforces type checking which helps a lot in terms of avoiding errors. There's an excellent native Pascal compiler for the Palm PDA that compiles into either 68000 (old - emulated) or THUMB (new - really native) instructions.
If you want to do really AI-ish stuff, I would stick to LISP, particularly the Scheme dialect. Scheme is very powerful, yet has some features (like special handling of tail recursion) that allow efficient interpreters and compilers. There's an interpreter for the Palm OS that's quite good although old and not maintained much and it's now open source.
See above, Not to quible, but I believe it is more closely aligned with VB than C++.·
I'll second the rest of the comments, but I'm not as fond of Pascal/Delphi (personal preference, nothing wrong with either).
I like LISP, It's fun.· I learned it as part of developing in older AutoCAD environments and did a few other projects with it.· Kind of out there on the fringes.
In direct answer to #1 of the original poster, and expanding on Mike's post:
It really does depend on what you are targeting, both from a perspective of application, and from the standpoint of what "platform" or "environment" you're going to be working in.
C or C++ and various flavors thereof (Visual C++, gnu C/C++, etc.) are possibly the most "universal" of languages at this point in time.· However, you can't (easily) program a web page in C/C++, or other devices (like the Propeller).
On the other hand, if you're thinking about a career in programming, you'll probably need to do some web based programming, and then you'll be needing PHP, Java and/or one of the various flavors of MS Scripting and/or .NET.
You'll see "veteran" progammers with a seemingly unending list of languages they've worked in.· The real thing to understand is that if you learn and develop good programming habbits and practices, picking up another language isn't that hard once you've learned the first couple.·
My personal suggestion: Pick a language to work on a project that you will enjoy.· If it's something with a STAMP, use PBasic.· If it's in Windows, use your choice of language.· Get "proficient" with that language.· Once you are comfortable, try a different language, and go from there.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John R.
8 + 8 = 10
Post Edited (John R.) : 8/18/2006 9:16:54 PM GMT
Unless you are using a cross-platform library, like Qt or GLUT/OpenGL...
The thought of learning LISP or PROLOG is something I have toyed with for awhile·- can LISP be used with the games I want to build? IF so whats a good resource for starting?
Getting back to the main question - given what is being considered what would be the recommendation to learn? C? C++? C#? or maybe something else?
Given your list of "want to do", this probably makes the most sense.
The ability to do games in LISP will depend on what user interface you want, and what LISP toolkit you use. In the "early" role playing games where everything was a text interface ("Game: You are in a room, there are three exits. User: Walk through center exit...") some of these were done with LISP. I don't know if you'll find a LISP compiler that will support graphics, etc. One alternative migh be to use someting like VB/C# or Visual C and write the graphics and user interface, and then call other programs or libraries written in LISP.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John R.
8 + 8 = 10
Post Edited (John R.) : 8/21/2006 3:53:04 PM GMT
C, C++, & C# are three very different languages, and are all used a bit differently. The 2 closest are C/C++, since C++ was built on top of C. C# is really a clone of Java, with some differences.
As for which one to learn, I suggest you start with plain old C. It's a much smaller language than the others, so it will be easier to learn & put to use quickly. You will be able to take most of what you learn to C++, and some of it to C#.
As for how to learn, I suggest you start with a product called Ch, which is a C/C++ interpreter. Setting up a C compiler can be a hassle, so rather than trying to figure out makefiles & compiler options, Ch isolates you from the process. Once you get a bit of experience, you can use a compiler if you want. Even if you use a compiler from the outset, Ch is very good for prototyping and trying things out, especially with the related ChSciTE text editor, since you don't need to set up any tools.
For Scheme, take a look at: www.plt-scheme.org
For Ch, take a look at: www.softintegration.com
>> Setting up a C compiler can be a hassle,
Or, not... depending on which compiler you choose (and which platform you are on). On OS X, the developer tools install like any other app; any standard install of Linux will include gcc already; and any of the Turbo-series DOS compilers is an easy setup...
On OS X, Xcode can be downloaded for free from:
http://connect.apple.com/
Turbo C++ 1.01 for DOS can be downloaded here for free:
http://bdn.borland.com/article/21751
Not yet released, but available soon:
http://www.turboexplorer.com/
For professional development, you will probbably want an optimising compiler that targets a modern platform (such as gcc under OS X or Linux; or any of the Borland products for Windows, or MS VC++).
Microcontrollers require a C compiler specific to that MCU; AVR, PIC, 8051, and (soon) the SX all have compilers that I am aware of. C/C++ tools are available for a number of other embedded processors as well (PPC, ColdFire, XScale, and DragonBall CPUs all come to mind). However, the Basic Stamp (and clones), Propeller, and a few others, require a language specific to the MCU (usually because of special hardware features - like, for example, the 8-core nature of the Propeller).
I found a book on C and one on C# and it sounds like they are good places to start. The SDK download uses C# so that will become a used language and C seems to be pretty common.