 |
|
 |
| Parallax Forums > Public Forums > The Sandbox > C, C+, C++ and C# | Forum Quick Jump
|
  |  John R. Registered Member

       Date Joined Sep 2005 Total Posts : 724 | Posted 8/18/2006 11:35 AM (GMT -8) |   | Well, that depends if you're working in a Microsoft centric environment or not.
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 | | Back to Top | | |
  |  Mike Green Registered Member

       Date Joined Oct 2004 Total Posts : 13550 | Posted 8/18/2006 12:25 PM (GMT -8) |   | Like all such questions, it depends on what you want to do. C is still very very useful, particularly when you're working with limited resources as in microcontrollers or hand-held computers (PDAs). There is a nice C compiler that runs on the Palm PDA, is fast, and produces native (68000) code. There are free C compilers that also run on embedded DOS computers with minimal resources. C++ like C is a standard language. You can find compilers that run on any desktop or laptop computer whether it's using Linux, Windows (of any version past Windows 98), or the Mac OS and produce excellent optimized native or cross compiled code for a variety of processors. C# is essentially a Microsoft proprietary extended C++. It's not as available widely as the supurb free open source compiler system originally developed for Linux and now running on all kinds of processors and OSs and it accepts C, C++, Pascal and others.
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. | | Back to Top | | |
 |  John R. Registered Member

       Date Joined Sep 2005 Total Posts : 724 | Posted 8/18/2006 1:02 PM (GMT -8) |   |
Mike Green said...
Snip
C# is essentially a Microsoft proprietary extended C++.
Mike;
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 | | Back to Top | | |
 |  Mike Green Registered Member

       Date Joined Oct 2004 Total Posts : 13550 | Posted 8/18/2006 1:37 PM (GMT -8) |   | | Ditto John's comments. It's like learning "foreign" languages. There are a lot of similarities, particularly among the Romance languages and among the Germanic languages. You can learn a lot from the differences between them and the concepts that some have and others do not (and vice versa). Tonal languages like Chinese require whole new skills from someone not raised on them. People often have programming "accents" that say a lot about what they learned first or most recently. It's also very different being a "tourist" vs. "living in a place". Programming languages tend to color how you think about a problem and knowing several helps you keep free of that. | | Back to Top | | |
 |  hammerhead74000 Registered Member
        Date Joined Jun 2006 Total Posts : 58 | Posted 8/19/2006 5:45 PM (GMT -8) |   | >> 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).
Unless you are using a cross-platform library, like Qt or GLUT/OpenGL... | | Back to Top | | |
   |  Mike Green Registered Member

       Date Joined Oct 2004 Total Posts : 13550 | Posted 8/21/2006 7:15 AM (GMT -8) |   | | Look at <www.plt-scheme.org> for a free, excellent implementation of Scheme (LISP) with books available, a GUI library, and many other features. It runs under Windows, Mac OS, and Linux and the Windows version has a COM library so you can build Active-X and COM-based interactive programs. It's intended for a teaching environment, so there's lots of examples and exercises. | | Back to Top | | |
 |  Kevin Wood Registered Member
        Date Joined Aug 2004 Total Posts : 768 | Posted 8/21/2006 8:15 AM (GMT -8) |   | Lisp can be used to build games, but you'll find more resources for other languages. When people say Lisp, they mostly are referring to Common Lisp, but there are other dialects. If you want to give it a try, I suggest Scheme, as Mike Green did. It is a simpler dialect than Common Lisp, but very powerful.
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 | | Back to Top | | |
 |  hammerhead74000 Registered Member
        Date Joined Jun 2006 Total Posts : 58 | Posted 8/21/2006 5:28 PM (GMT -8) |   | If by game, you mean something like Doom or Halo, then you will need to learn C and C++, and OpenGL w/ GLSL; as well as some platform specifics depending on where you intend to develop/deploy...
>> 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). | | Back to Top | | |
 | Forum Information | Currently it is Friday, November 20, 2009 5:53 PM (GMT -8) There are a total of 393,695 posts in 55,520 threads. In the last 3 days there were 88 new threads and 709 reply posts. View Active Threads
| | Who's Online | This forum has 17684 registered members. Please welcome our newest member, Dogg. 53 Guest(s), 10 Registered Member(s) are currently online. Details boeboy, Peter Jakacki, Phil Pilgrim (PhiPi), mctrivia, pacman, ElectricAye, Todd Chapman, Kye, potatohead, pharseid |
Forum powered by dotNetBB v2.42EC SP2.02 dotNetBB © 2000-2009 |
|
|