| The SourceMe page,
the one about C and
Assembly. |
| This page is a helpful
reference for the SpareMe and CompileMe
Pages. |
| The C language was first
used to port the Unix
Project from the PDP-7 to the PDP-11. C's creator is Dennis Richie. In a way, C and Unix are bound together, since C was was originally created for Unix portability. Q: Why in C and not in Assembly again? A: The C language is medium level, compact, procedural, modular, portable and multi-purpose. Explaining: Medium Level: It uses arithmetic and logical operators to calculate bytes, integers (groups of 2 or 4 bytes), pointers of data (locations in memory) - a very powerful capability - and strings (groups of characters). Compact: It is small and has a good structure. Every complicated command, like comparing strings, is in reality a function written in C or Assembly and placed inside a library. Procedural: Every complicated task is defined by a specific function that can be called many times, but is defined only once. This is useful for keeping the source "structured", economic, understandable and easily editable. Modular: What is used many times or simply does not need to be inside the main source code, can very easily be outside, as a source file or as a compiled binary file. The compiled binaries are called shared objects, or libraries. Portable: A C source code can be localized to a specific processor, using even assembly code for optimization purposes. But it can be portable at the same time, even if assembly is used! You just need: A C compiler to create the binaries and libraries created in C A version of the library created in assembly for your machine, or a way to create it locally (an assembler and the processor - specific assembly code). Multi Purpose: C is neither a pure mathematic language like Fortran, nor pure Graphics language like Logo. It is a language that can talk to our processor (remember operators) and the rest is added by libraries. C can make very fast programs. In certain occasions when large data moves between variables, instead of copying or moving the data, only the pointers to the data (location in memory) have to change. And of course, C is neither an Object Oriented language like C++ or Objective C, nor an Artificial Intelligence language like Prolog (Or Lisp in some ways). |