It was thus said that the Great CLASSICCMP_at_trailing-edge.com once stated:
>
> William Donzelli pointed out:
> > C is well established, Java is not.
>
> True, but C itself if far from portable. The endless maze of #ifdef's
> that are necessary to make a piece of source code portable among a limited
> set of machines and OS's are fine and dandy unless you have to support all
> those different permutations!
As a software geek, C is quite portable, as long as you keep several
things in mind, like shorts are at least 16 bits, longs are at least 32
bits, ints are at least 16 bits and can't be longer than a long, and don't
use functions not defined in the Standard C library (or stuff you've
written).
It's only when you strive for solid, reliable robust code that you have to
skip past the Standard C library and that's when you start having all those
insipid #ifdef's all over the place. It takes experience and some skill to
deal with that stuff cleanly [1].
> It's almost as bad as those web pages that come up
> and *insist* that you change your graphics mode to 640x480 or
> some other particular size - why do folks insist on starting with a
> nice general information-based document standard and then turn it into
> a nonportable one???!!!
They spend an inordinate amount of time getting the stuff to look decent
on *their* system and they assume everyone has the same set up. Also (as
far as coding goes) it's easier to write non-portable code than it is
portable [2]. Sorry. Unless the content is very compelling, if I can't
read it, I'll move on.
-spc (Heretic programmer and computer crumudgeon ... )
[1] Basically, it comes down to abstraction. If you can hide the
non-portable stuff within a function you have a better chance of
dealing with more ports. A program I wrote [3] for Unix needed
a few functions changed (about 4) to run successfully under
Windows.
[2] Actually, it's pretty easy, as long as you plan from the start to
make the program portable. But I'm afraid most programmers don't
design as much as hack away at things. Linux was like that, and
it took about three years to get it ``portable.'' I would like
for students in CS departments to be forced to write code for
two or more different platforms, but alas, I doubt that'll every
come to pass.
[3] It's actually a CGI program in C that's being turned into a stand-
alone program for Windows. You can play with it at
http://www.geofind.com/
Received on Mon Sep 21 1998 - 09:21:49 BST