On Thu, 24 Jan 2002, Bastiaan Edelman, PA3FFZ wrote: > On Wed, 23 Jan 2002 23:15:38 -0500 (EST), Steve <[EMAIL PROTECTED]> wrote: > > > The advantage of C is that it's cross-platform. > > A C program isn't inherently "DOS" or Linux, or > > even x86, PPC, sparc, or 68xxx. > > Sure, take your "Hello World" source, compile it > > with Linux gcc, and it runs in Linux. Compile it on a > > Commodore 64 compiler and it runs on the Commodore. > > > Ideally, all C that can be compiled on one platform > > would be able to be compiled without change on all > > platforms. That isn't quite the case, hence the need > > to "port" from one platform to another. > > > - Steve > > Does that make C an operating system?
Some OS's are written in C, but C itself is a high-level (compiled) programming language. Other high-level languages are interpreted; that is they are parsed, translated, and executed all at runtime; each time they're run. Compiled languages are parsed and translated into machine code once. Then that code is the only thing that's executed at runtime. Compiled languages have the advantage of being faster since they only need to be parsed and translated once. The resulting executable code is therefore much faster than comparable applications written in interpreted languages. Interpreted languages have the advantage of being easier to debug. If you get an error, you just go fix it and rerun to check, whereas in a compiled language the source has to be fixed and recompiled before you know whether your fix was successful. > Abt 20 years ago computers like Sinclair and MSX had BASIC for their OS. There are MANY versions of BASIC available for Linux. > Would it be possible to re-compile DOS and other OS's (even windows?) to > C, BASIC or whatever higher programming language? In a way, that's been done already. Dosemu (DOS emulator) is a Linux program which emulates DOS. It's written in C. Wine (Wine Is Not an Emulator) is also written in C. It's a reverse-enineering of the Windows API calls. It allows you to run Windows programs under Linux. > Or machine specific 'mnemonics'? Though not commonly done, you can also write Assembly Code in Linux. This will be CPU-specific, so if you write something for a Pentium, for instance, it won't work on PPC or SPARC or Motorola 68xxx (or Commodore 65xx) CPU's. Matter of fact, if you write Assembly for a 586, it very likely won't even run on a 386. - Steve
