Page 1 of 1

C Portability

Posted: Wed Feb 25, 2004 1:28 am
by firas981
I know that not every c code is portable , however in following some rules we can make c code portable ....
why this is not ( or less) possible in other languages ?
what is the in-depth reason ?
thanks..

Re:C Portability

Posted: Wed Feb 25, 2004 2:31 am
by Schol-R-LEA
There really isn't any reason for it; in fact, quite a number of languages are highly portable, including Fortran, Ada, Perl, Python, and Common Lisp.

There are three common reasons which keep a language from being portable. First, languages written for a specific platform often have platform-dependent features; a good example of this is VB6 and earlier, which was very tightly bound to the Windows environment (VB.Nyet is somewhat less so, supposedly).

A second reason is that the language definition may be ambiguous or inadequate; in the case of proprietary languages such as VB or Powerbuilder (both BASIC dialects), ther might not even be a published standard, and the language is limited to those platforms the vendor is willing to provide it for.

The third problem, often closely related to the second (EDIT: not first as I originally wrote), is that software vendors often add extensions that are specific to their compiler, in effect creating an incompatible dialect; code using the extension is then dependent on the specific compiler. This last problem has been a recurring issue for both Pascal and Scheme, languages which take minimalism to an uncomfortable extreme and so often are extended just to provide basic functionality (with Scheme, this is an irritation, as most extensions can be done within the language itself; in Pascal, which is far less extensible and thus must be altered at the compiler itself, it has very nearly been a fatal flaw).

Re:C Portability

Posted: Wed Feb 25, 2004 10:26 am
by ASHLEY4
C is one of the most portable languages, But when i was learn it, Even simple code ,would give 10s of errors,if i try to compiled on another C compiler.
What is avalable (standard librarys) that is portable is very basic.
eg: try get a standard clear screen.
Yet with pascal 99% worked, because there was only one doment pascal "turbo pascal"

One important thing to remeber is, what a program is writen in, Is just for humans to understand.
eg:
bill gates,4
;************
bill = mov
gates = ax

Would compile in a assembler. (compile = assembler)

ASHLEY4.