From: Salim Fadhley <s...@urn.nott.ac.uk>
Subject: Is C portable?
organization: Cripps Computing Centre, The University of Nottingham
content-type: TEXT/PLAIN; charset=US-ASCII
Ok in a vain attempt to settle this argument:
C isnt perfectly portable, and more than one type of C exists, but
within one flavour of C we can have a reasonably good level of portability.
I program in GNU C, and I know I can compile the same linux kernel up on
a SUN and a Intel box. Both computers run GNU C.
However a program that has been written in Boreland C for DOS might not
compile up on UNIX because it includes functions that only exist in
However if we stick purely to ANSI C then unless we are writing stuff
that messes directly with the hardware then it should compile up on
almost any correct C compiler, so a subset of any C flavoured language
should be portable.
My conclusion is that C is not perfectly portable but, it's portability
is a comprimise between having machine spesific components and
consistancy between platforms. I suggest that C represents a Reasonable
I conclude that portability is not just a property of the language but
also the style in which you express your programs, therfore you might
write reasonably portable assembler or you might also write C that is
appalingly impossible to port.
Hopefully even Scott could agree with that.
Salim Fadhley - CS Undergraduate
The time now is all the time.
From: Andrew Veliath <vel...@rpi.edu>
Subject: Re: Is C portable?
organization: Rensselaer Polytechnic Institute, The United States of America
>>>>> Salim Fadhley writes:
Salim> I conclude that portability is not just a property of the
Salim> language but also the style in which you express your
Salim> programs, therfore you might write reasonably portable
Salim> assembler or you might also write C that is appalingly
Salim> impossible to port.
This is quite true. I could write an ANSI C program which runs, say,
on an embedded MC68332 processor and my Unix machine, but if I always
assumed a standard character display width I would consider it
unportable, and it would be completely my fault. If the program
accounts for different display widths for instance, it would be more
proper. But, here is my view of "portability." Take it or leave it.
Portability proper, refers to an aspect of bearability. It is, in
general, relative. For computer hardware, it could refer to ease in
transport; bearable transport by one person (i.e. remember luggable
computers?). Obviously, an SGI Power Challenge full tower would not
fit this definition, but given a truck like the SGI truck which rolls
around it might be portable in that sense.
For computer software, in particular the programmer's architectural
view, most software is not ideally portable. Ideally, a absolutely
portable program (zero in the bearability sense) would require no
changes or conditional compilations (regardless of the language layer)
to run equally well on different architectures. This ideal (as most
ideals) is not practical, and impossible in many cases due to
irreconcilable architectural differences.
The next best thing to ideal portability is portability, which again,
referring to the aspect of a reasonable level of bearability, would
imply relatively bearable changes for each architectural target,
resulting in some sort of abstraction (whether intended or not). For
example, Windows NT implements something called the HAL; this Hardware
Abstraction Layer is such a device with the pure function of
porability. Using this layer results in markedly less conditional
code in higher level programming constructs.
Therefore, in asking whether C is portable, I would say yes; not in
the ideal sense, since most programs aren't written in 100% ANSI C,
but yes since it makes it bearable to transfer your code to another
platform or processor. In other words, it won't be ideally portable
in the sense that every line of code will work under the new platform,
but it will be portable in the sense that providing you wrote it with
an eye on portability you won't have to change every single line to
reflect the new platform, which would be a heck of a lot of useless
work. You would only need to rewrite the small parts which interact
with the hardware, and to make minimal changes elsewhere (again this
is all dependent upon good design). Most algorithmic type code should
be written in ANSI C (or C++ when it is standardized) as to require
practically no changes. ANSI C code which is algorithmic or I/O
independent can be considered practical examples of near ideal
portability as long as one accounts for machine word sizes (which one
should try to avoid in this type of code anyway).
Andrew Veliath <vel...@rpi.edu> http://www.rpi.edu/~veliaa
I'm not scared of anything because I'm scared of everything.
Finger for PGP Public Key
Key fingerprint = 51 56 5D 3E 51 43 8B 74 7C B2 E4 B6 84 8E 8B 08
USENET (Users’ Network) was a bulletin board shared among many computer
systems around the world. USENET was a logical network, sitting on top
of several physical networks, among them UUCP, BLICN, BERKNET, X.25, and
the ARPANET. Sites on USENET included many universities, private companies
and research organizations. See USENET Archives.
SCO Files Lawsuit Against IBM
March 7, 2003 - The SCO Group filed legal action against IBM in the State
Court of Utah for trade secrets misappropriation, tortious interference,
unfair competition and breach of contract. The complaint alleges that IBM
made concentrated efforts to improperly destroy the economic value of
UNIX, particularly UNIX on Intel, to benefit IBM's Linux services
business. See SCO vs IBM.
The materials and information included in this website may only be used
for purposes such as criticism, review, private study, scholarship, or
Electronic mail: WorldWideWeb: